Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/commands/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Version extends BaseCommand {
]

static workspaces = true
static ignoreImplicitWorkspace = false
static skipConfigValidation = true

static usage = ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]']
Expand Down
40 changes: 40 additions & 0 deletions test/lib/commands/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,46 @@ t.test('empty versions', async t => {
t.matchSnapshot(readFileSync(resolve(prefix, 'package-lock.json'), 'utf8'))
})

t.test('with one arg in an implicit workspace', async t => {
const paths = []
const { version, prefix } = await mockNpm(t, {
prefixDir: {
'package.json': JSON.stringify({
name: 'workspaces-test',
version: '1.0.0',
workspaces: ['workspace-a', 'workspace-b'],
}),
'workspace-a': {
'package.json': JSON.stringify({
name: 'workspace-a',
version: '1.0.0',
}),
},
'workspace-b': {
'package.json': JSON.stringify({
name: 'workspace-b',
version: '1.0.0',
}),
},
},
chdir: ({ prefix }) => resolve(prefix, 'workspace-a'),
config: {
'workspaces-update': false,
},
mocks: {
libnpmversion: (_version, opts) => {
paths.push(opts.path)
return '1.0.1'
},
},
})

await version.exec(['patch'])

t.strictSame(paths, [resolve(prefix, 'workspace-a')],
'only versions the implicit workspace')
})

t.test('with one arg, all workspaces, saves package.json', async t => {
const { version, outputs, prefix } = await mockNpm(t, {
prefixDir: {
Expand Down