11cb0ef41Sopenharmony_ciconst { readFileSync, statSync } = require('fs')
21cb0ef41Sopenharmony_ciconst { resolve } = require('path')
31cb0ef41Sopenharmony_ciconst t = require('tap')
41cb0ef41Sopenharmony_ciconst _mockNpm = require('../../fixtures/mock-npm')
51cb0ef41Sopenharmony_ciconst mockGlobals = require('@npmcli/mock-globals')
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst mockNpm = async (t, opts = {}) => {
81cb0ef41Sopenharmony_ci  const res = await _mockNpm(t, {
91cb0ef41Sopenharmony_ci    ...opts,
101cb0ef41Sopenharmony_ci    command: 'version',
111cb0ef41Sopenharmony_ci    mocks: {
121cb0ef41Sopenharmony_ci      ...opts.mocks,
131cb0ef41Sopenharmony_ci      '{ROOT}/package.json': { version: '1.0.0' },
141cb0ef41Sopenharmony_ci    },
151cb0ef41Sopenharmony_ci  })
161cb0ef41Sopenharmony_ci  return {
171cb0ef41Sopenharmony_ci    ...res,
181cb0ef41Sopenharmony_ci    result: () => res.outputs[0],
191cb0ef41Sopenharmony_ci  }
201cb0ef41Sopenharmony_ci}
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cit.test('node@1', async t => {
231cb0ef41Sopenharmony_ci  mockGlobals(t, { 'process.versions': { node: '1.0.0' } }, { replace: true })
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci  t.test('no args', async t => {
261cb0ef41Sopenharmony_ci    const { version, result } = await mockNpm(t, {
271cb0ef41Sopenharmony_ci      prefixDir: {
281cb0ef41Sopenharmony_ci        'package.json': JSON.stringify({
291cb0ef41Sopenharmony_ci          name: 'test-version-no-args',
301cb0ef41Sopenharmony_ci          version: '3.2.1',
311cb0ef41Sopenharmony_ci        }),
321cb0ef41Sopenharmony_ci      },
331cb0ef41Sopenharmony_ci    })
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci    await version.exec([])
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci    t.strictSame(
381cb0ef41Sopenharmony_ci      result(),
391cb0ef41Sopenharmony_ci      [{
401cb0ef41Sopenharmony_ci        'test-version-no-args': '3.2.1',
411cb0ef41Sopenharmony_ci        node: '1.0.0',
421cb0ef41Sopenharmony_ci        npm: '1.0.0',
431cb0ef41Sopenharmony_ci      }],
441cb0ef41Sopenharmony_ci      'should output expected values for various versions in npm'
451cb0ef41Sopenharmony_ci    )
461cb0ef41Sopenharmony_ci  })
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci  t.test('too many args', async t => {
491cb0ef41Sopenharmony_ci    const { version } = await mockNpm(t)
501cb0ef41Sopenharmony_ci    await t.rejects(
511cb0ef41Sopenharmony_ci      version.exec(['foo', 'bar']),
521cb0ef41Sopenharmony_ci      /npm version/,
531cb0ef41Sopenharmony_ci      'should throw usage instructions error'
541cb0ef41Sopenharmony_ci    )
551cb0ef41Sopenharmony_ci  })
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci  t.test('completion', async t => {
581cb0ef41Sopenharmony_ci    const { version } = await mockNpm(t)
591cb0ef41Sopenharmony_ci    const testComp = async (argv, expect) => {
601cb0ef41Sopenharmony_ci      const res = await version.completion({ conf: { argv: { remain: argv } } })
611cb0ef41Sopenharmony_ci      t.strictSame(res, expect, argv.join(' '))
621cb0ef41Sopenharmony_ci    }
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ci    await testComp(
651cb0ef41Sopenharmony_ci      ['npm', 'version'],
661cb0ef41Sopenharmony_ci      ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease', 'from-git']
671cb0ef41Sopenharmony_ci    )
681cb0ef41Sopenharmony_ci    await testComp(['npm', 'version', 'major'], [])
691cb0ef41Sopenharmony_ci  })
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_ci  t.test('failure reading package.json', async t => {
721cb0ef41Sopenharmony_ci    const { version, result } = await mockNpm(t)
731cb0ef41Sopenharmony_ci
741cb0ef41Sopenharmony_ci    await version.exec([])
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ci    t.strictSame(
771cb0ef41Sopenharmony_ci      result(),
781cb0ef41Sopenharmony_ci      [{
791cb0ef41Sopenharmony_ci        npm: '1.0.0',
801cb0ef41Sopenharmony_ci        node: '1.0.0',
811cb0ef41Sopenharmony_ci      }],
821cb0ef41Sopenharmony_ci      'should not have package name on returning object'
831cb0ef41Sopenharmony_ci    )
841cb0ef41Sopenharmony_ci  })
851cb0ef41Sopenharmony_ci})
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_cit.test('empty versions', async t => {
881cb0ef41Sopenharmony_ci  mockGlobals(t, { 'process.versions': {} }, { replace: true })
891cb0ef41Sopenharmony_ci
901cb0ef41Sopenharmony_ci  t.test('--json option', async t => {
911cb0ef41Sopenharmony_ci    const { version, result } = await mockNpm(t, {
921cb0ef41Sopenharmony_ci      config: { json: true },
931cb0ef41Sopenharmony_ci    })
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci    await version.exec([])
961cb0ef41Sopenharmony_ci    t.same(result(), ['{\n  "npm": "1.0.0"\n}'], 'should return json stringified result')
971cb0ef41Sopenharmony_ci  })
981cb0ef41Sopenharmony_ci
991cb0ef41Sopenharmony_ci  t.test('with one arg', async t => {
1001cb0ef41Sopenharmony_ci    const { version, result } = await mockNpm(t, {
1011cb0ef41Sopenharmony_ci      mocks: {
1021cb0ef41Sopenharmony_ci        libnpmversion: () => '4.0.0',
1031cb0ef41Sopenharmony_ci      },
1041cb0ef41Sopenharmony_ci    })
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci    await version.exec(['major'])
1071cb0ef41Sopenharmony_ci    t.same(result(), ['v4.0.0'], 'outputs the new version prefixed by the tagVersionPrefix')
1081cb0ef41Sopenharmony_ci  })
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci  t.test('workspaces', async t => {
1111cb0ef41Sopenharmony_ci    t.test('no args, all workspaces', async t => {
1121cb0ef41Sopenharmony_ci      const { version, result } = await mockNpm(t, {
1131cb0ef41Sopenharmony_ci        prefixDir: {
1141cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
1151cb0ef41Sopenharmony_ci            {
1161cb0ef41Sopenharmony_ci              name: 'workspaces-test',
1171cb0ef41Sopenharmony_ci              version: '1.0.0',
1181cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b'],
1191cb0ef41Sopenharmony_ci            },
1201cb0ef41Sopenharmony_ci            null,
1211cb0ef41Sopenharmony_ci            2
1221cb0ef41Sopenharmony_ci          ),
1231cb0ef41Sopenharmony_ci          'workspace-a': {
1241cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
1251cb0ef41Sopenharmony_ci              name: 'workspace-a',
1261cb0ef41Sopenharmony_ci              version: '1.0.0',
1271cb0ef41Sopenharmony_ci            }),
1281cb0ef41Sopenharmony_ci          },
1291cb0ef41Sopenharmony_ci          'workspace-b': {
1301cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
1311cb0ef41Sopenharmony_ci              name: 'workspace-b',
1321cb0ef41Sopenharmony_ci              version: '1.0.0',
1331cb0ef41Sopenharmony_ci            }),
1341cb0ef41Sopenharmony_ci          },
1351cb0ef41Sopenharmony_ci        },
1361cb0ef41Sopenharmony_ci        config: { workspaces: true },
1371cb0ef41Sopenharmony_ci      })
1381cb0ef41Sopenharmony_ci
1391cb0ef41Sopenharmony_ci      await version.exec([])
1401cb0ef41Sopenharmony_ci      t.same(
1411cb0ef41Sopenharmony_ci        result(),
1421cb0ef41Sopenharmony_ci        [
1431cb0ef41Sopenharmony_ci          {
1441cb0ef41Sopenharmony_ci            'workspaces-test': '1.0.0',
1451cb0ef41Sopenharmony_ci            'workspace-a': '1.0.0',
1461cb0ef41Sopenharmony_ci            'workspace-b': '1.0.0',
1471cb0ef41Sopenharmony_ci            npm: '1.0.0',
1481cb0ef41Sopenharmony_ci          },
1491cb0ef41Sopenharmony_ci        ],
1501cb0ef41Sopenharmony_ci        'outputs includes main package and workspace versions'
1511cb0ef41Sopenharmony_ci      )
1521cb0ef41Sopenharmony_ci    })
1531cb0ef41Sopenharmony_ci
1541cb0ef41Sopenharmony_ci    t.test('no args, single workspaces', async t => {
1551cb0ef41Sopenharmony_ci      const { version, result } = await mockNpm(t, {
1561cb0ef41Sopenharmony_ci        prefixDir: {
1571cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
1581cb0ef41Sopenharmony_ci            {
1591cb0ef41Sopenharmony_ci              name: 'workspaces-test',
1601cb0ef41Sopenharmony_ci              version: '1.0.0',
1611cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b'],
1621cb0ef41Sopenharmony_ci            },
1631cb0ef41Sopenharmony_ci            null,
1641cb0ef41Sopenharmony_ci            2
1651cb0ef41Sopenharmony_ci          ),
1661cb0ef41Sopenharmony_ci          'workspace-a': {
1671cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
1681cb0ef41Sopenharmony_ci              name: 'workspace-a',
1691cb0ef41Sopenharmony_ci              version: '1.0.0',
1701cb0ef41Sopenharmony_ci            }),
1711cb0ef41Sopenharmony_ci          },
1721cb0ef41Sopenharmony_ci          'workspace-b': {
1731cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
1741cb0ef41Sopenharmony_ci              name: 'workspace-b',
1751cb0ef41Sopenharmony_ci              version: '1.0.0',
1761cb0ef41Sopenharmony_ci            }),
1771cb0ef41Sopenharmony_ci          },
1781cb0ef41Sopenharmony_ci        },
1791cb0ef41Sopenharmony_ci        config: {
1801cb0ef41Sopenharmony_ci          workspace: 'workspace-a',
1811cb0ef41Sopenharmony_ci        },
1821cb0ef41Sopenharmony_ci      })
1831cb0ef41Sopenharmony_ci
1841cb0ef41Sopenharmony_ci      await version.exec([])
1851cb0ef41Sopenharmony_ci      t.same(
1861cb0ef41Sopenharmony_ci        result(),
1871cb0ef41Sopenharmony_ci        [
1881cb0ef41Sopenharmony_ci          {
1891cb0ef41Sopenharmony_ci            'workspaces-test': '1.0.0',
1901cb0ef41Sopenharmony_ci            'workspace-a': '1.0.0',
1911cb0ef41Sopenharmony_ci            npm: '1.0.0',
1921cb0ef41Sopenharmony_ci          },
1931cb0ef41Sopenharmony_ci        ],
1941cb0ef41Sopenharmony_ci        'outputs includes main package and requested workspace versions'
1951cb0ef41Sopenharmony_ci      )
1961cb0ef41Sopenharmony_ci    })
1971cb0ef41Sopenharmony_ci
1981cb0ef41Sopenharmony_ci    t.test('no args, all workspaces, workspace with missing name or version', async t => {
1991cb0ef41Sopenharmony_ci      const { version, result } = await mockNpm(t, {
2001cb0ef41Sopenharmony_ci        prefixDir: {
2011cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
2021cb0ef41Sopenharmony_ci            {
2031cb0ef41Sopenharmony_ci              name: 'workspaces-test',
2041cb0ef41Sopenharmony_ci              version: '1.0.0',
2051cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
2061cb0ef41Sopenharmony_ci            },
2071cb0ef41Sopenharmony_ci            null,
2081cb0ef41Sopenharmony_ci            2
2091cb0ef41Sopenharmony_ci          ),
2101cb0ef41Sopenharmony_ci          'workspace-a': {
2111cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
2121cb0ef41Sopenharmony_ci              name: 'workspace-a',
2131cb0ef41Sopenharmony_ci              version: '1.0.0',
2141cb0ef41Sopenharmony_ci            }),
2151cb0ef41Sopenharmony_ci          },
2161cb0ef41Sopenharmony_ci          'workspace-b': {
2171cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
2181cb0ef41Sopenharmony_ci              name: 'workspace-b',
2191cb0ef41Sopenharmony_ci            }),
2201cb0ef41Sopenharmony_ci          },
2211cb0ef41Sopenharmony_ci          'workspace-c': {
2221cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
2231cb0ef41Sopenharmony_ci              version: '1.0.0',
2241cb0ef41Sopenharmony_ci            }),
2251cb0ef41Sopenharmony_ci          },
2261cb0ef41Sopenharmony_ci        },
2271cb0ef41Sopenharmony_ci        config: { workspaces: true },
2281cb0ef41Sopenharmony_ci      })
2291cb0ef41Sopenharmony_ci
2301cb0ef41Sopenharmony_ci      await version.exec([])
2311cb0ef41Sopenharmony_ci      t.same(
2321cb0ef41Sopenharmony_ci        result(),
2331cb0ef41Sopenharmony_ci        [
2341cb0ef41Sopenharmony_ci          {
2351cb0ef41Sopenharmony_ci            'workspaces-test': '1.0.0',
2361cb0ef41Sopenharmony_ci            'workspace-a': '1.0.0',
2371cb0ef41Sopenharmony_ci            npm: '1.0.0',
2381cb0ef41Sopenharmony_ci          },
2391cb0ef41Sopenharmony_ci        ],
2401cb0ef41Sopenharmony_ci        'outputs includes main package and valid workspace versions'
2411cb0ef41Sopenharmony_ci      )
2421cb0ef41Sopenharmony_ci    })
2431cb0ef41Sopenharmony_ci
2441cb0ef41Sopenharmony_ci    t.test('with one arg, all workspaces', async t => {
2451cb0ef41Sopenharmony_ci      const { version, outputs, prefix } = await mockNpm(t, {
2461cb0ef41Sopenharmony_ci        prefixDir: {
2471cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
2481cb0ef41Sopenharmony_ci            {
2491cb0ef41Sopenharmony_ci              name: 'workspaces-test',
2501cb0ef41Sopenharmony_ci              version: '1.0.0',
2511cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b'],
2521cb0ef41Sopenharmony_ci            },
2531cb0ef41Sopenharmony_ci            null,
2541cb0ef41Sopenharmony_ci            2
2551cb0ef41Sopenharmony_ci          ),
2561cb0ef41Sopenharmony_ci          'workspace-a': {
2571cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
2581cb0ef41Sopenharmony_ci              name: 'workspace-a',
2591cb0ef41Sopenharmony_ci              version: '1.0.0',
2601cb0ef41Sopenharmony_ci            }),
2611cb0ef41Sopenharmony_ci          },
2621cb0ef41Sopenharmony_ci          'workspace-b': {
2631cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
2641cb0ef41Sopenharmony_ci              name: 'workspace-b',
2651cb0ef41Sopenharmony_ci              version: '1.0.0',
2661cb0ef41Sopenharmony_ci            }),
2671cb0ef41Sopenharmony_ci          },
2681cb0ef41Sopenharmony_ci        },
2691cb0ef41Sopenharmony_ci        config: { workspaces: true },
2701cb0ef41Sopenharmony_ci      })
2711cb0ef41Sopenharmony_ci
2721cb0ef41Sopenharmony_ci      await version.exec(['major'])
2731cb0ef41Sopenharmony_ci      t.same(
2741cb0ef41Sopenharmony_ci        outputs.map(o => o[0]).slice(0, 4),
2751cb0ef41Sopenharmony_ci        ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
2761cb0ef41Sopenharmony_ci        'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
2771cb0ef41Sopenharmony_ci      )
2781cb0ef41Sopenharmony_ci
2791cb0ef41Sopenharmony_ci      t.matchSnapshot(readFileSync(resolve(prefix, 'package-lock.json'), 'utf8'))
2801cb0ef41Sopenharmony_ci    })
2811cb0ef41Sopenharmony_ci
2821cb0ef41Sopenharmony_ci    t.test('with one arg, all workspaces, saves package.json', async t => {
2831cb0ef41Sopenharmony_ci      const { version, outputs, prefix } = await mockNpm(t, {
2841cb0ef41Sopenharmony_ci        prefixDir: {
2851cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
2861cb0ef41Sopenharmony_ci            {
2871cb0ef41Sopenharmony_ci              name: 'workspaces-test',
2881cb0ef41Sopenharmony_ci              version: '1.0.0',
2891cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b'],
2901cb0ef41Sopenharmony_ci              dependencies: {
2911cb0ef41Sopenharmony_ci                'workspace-a': '^1.0.0',
2921cb0ef41Sopenharmony_ci                'workspace-b': '^1.0.0',
2931cb0ef41Sopenharmony_ci              },
2941cb0ef41Sopenharmony_ci            },
2951cb0ef41Sopenharmony_ci            null,
2961cb0ef41Sopenharmony_ci            2
2971cb0ef41Sopenharmony_ci          ),
2981cb0ef41Sopenharmony_ci          'workspace-a': {
2991cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
3001cb0ef41Sopenharmony_ci              name: 'workspace-a',
3011cb0ef41Sopenharmony_ci              version: '1.0.0',
3021cb0ef41Sopenharmony_ci            }),
3031cb0ef41Sopenharmony_ci          },
3041cb0ef41Sopenharmony_ci          'workspace-b': {
3051cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
3061cb0ef41Sopenharmony_ci              name: 'workspace-b',
3071cb0ef41Sopenharmony_ci              version: '1.0.0',
3081cb0ef41Sopenharmony_ci            }),
3091cb0ef41Sopenharmony_ci          },
3101cb0ef41Sopenharmony_ci        },
3111cb0ef41Sopenharmony_ci        config: {
3121cb0ef41Sopenharmony_ci          save: true,
3131cb0ef41Sopenharmony_ci          workspaces: true,
3141cb0ef41Sopenharmony_ci        },
3151cb0ef41Sopenharmony_ci      })
3161cb0ef41Sopenharmony_ci
3171cb0ef41Sopenharmony_ci      await version.exec(['major'])
3181cb0ef41Sopenharmony_ci      t.same(
3191cb0ef41Sopenharmony_ci        outputs.map(o => o[0]).slice(0, 4),
3201cb0ef41Sopenharmony_ci        ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
3211cb0ef41Sopenharmony_ci        'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
3221cb0ef41Sopenharmony_ci      )
3231cb0ef41Sopenharmony_ci
3241cb0ef41Sopenharmony_ci      t.matchSnapshot(readFileSync(resolve(prefix, 'package-lock.json'), 'utf8'))
3251cb0ef41Sopenharmony_ci    })
3261cb0ef41Sopenharmony_ci
3271cb0ef41Sopenharmony_ci    t.test('too many args', async t => {
3281cb0ef41Sopenharmony_ci      const { version } = await mockNpm(t, { config: { workspaces: true } })
3291cb0ef41Sopenharmony_ci
3301cb0ef41Sopenharmony_ci      await t.rejects(
3311cb0ef41Sopenharmony_ci        version.exec(['foo', 'bar']),
3321cb0ef41Sopenharmony_ci        /npm version/,
3331cb0ef41Sopenharmony_ci        'should throw usage instructions error'
3341cb0ef41Sopenharmony_ci      )
3351cb0ef41Sopenharmony_ci    })
3361cb0ef41Sopenharmony_ci
3371cb0ef41Sopenharmony_ci    t.test('no workspaces-update', async t => {
3381cb0ef41Sopenharmony_ci      const { version, outputs, prefix } = await mockNpm(t, {
3391cb0ef41Sopenharmony_ci        prefixDir: {
3401cb0ef41Sopenharmony_ci          'package.json': JSON.stringify(
3411cb0ef41Sopenharmony_ci            {
3421cb0ef41Sopenharmony_ci              name: 'workspaces-test',
3431cb0ef41Sopenharmony_ci              version: '1.0.0',
3441cb0ef41Sopenharmony_ci              workspaces: ['workspace-a', 'workspace-b'],
3451cb0ef41Sopenharmony_ci            },
3461cb0ef41Sopenharmony_ci            null,
3471cb0ef41Sopenharmony_ci            2
3481cb0ef41Sopenharmony_ci          ),
3491cb0ef41Sopenharmony_ci          'workspace-a': {
3501cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
3511cb0ef41Sopenharmony_ci              name: 'workspace-a',
3521cb0ef41Sopenharmony_ci              version: '1.0.0',
3531cb0ef41Sopenharmony_ci            }),
3541cb0ef41Sopenharmony_ci          },
3551cb0ef41Sopenharmony_ci          'workspace-b': {
3561cb0ef41Sopenharmony_ci            'package.json': JSON.stringify({
3571cb0ef41Sopenharmony_ci              name: 'workspace-b',
3581cb0ef41Sopenharmony_ci              version: '1.0.0',
3591cb0ef41Sopenharmony_ci            }),
3601cb0ef41Sopenharmony_ci          },
3611cb0ef41Sopenharmony_ci        },
3621cb0ef41Sopenharmony_ci        mocks: {
3631cb0ef41Sopenharmony_ci          libnpmversion: (arg, opts) => {
3641cb0ef41Sopenharmony_ci            return '2.0.0'
3651cb0ef41Sopenharmony_ci          },
3661cb0ef41Sopenharmony_ci        },
3671cb0ef41Sopenharmony_ci        config: {
3681cb0ef41Sopenharmony_ci          workspaces: true,
3691cb0ef41Sopenharmony_ci          'workspaces-update': false,
3701cb0ef41Sopenharmony_ci        },
3711cb0ef41Sopenharmony_ci      })
3721cb0ef41Sopenharmony_ci
3731cb0ef41Sopenharmony_ci      await version.exec(['major'])
3741cb0ef41Sopenharmony_ci      t.same(
3751cb0ef41Sopenharmony_ci        outputs.map(o => o[0]).slice(0, 4),
3761cb0ef41Sopenharmony_ci        ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
3771cb0ef41Sopenharmony_ci        'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
3781cb0ef41Sopenharmony_ci      )
3791cb0ef41Sopenharmony_ci
3801cb0ef41Sopenharmony_ci      t.throws(
3811cb0ef41Sopenharmony_ci        () => statSync(resolve(prefix, 'package-lock.json')),
3821cb0ef41Sopenharmony_ci        'should not have a lockfile since have not reified'
3831cb0ef41Sopenharmony_ci      )
3841cb0ef41Sopenharmony_ci    })
3851cb0ef41Sopenharmony_ci  })
3861cb0ef41Sopenharmony_ci})
387