Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: npm config warn on workspaces #2950

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/config.js
Expand Up @@ -89,6 +89,7 @@ class Config extends BaseCommand {
}

execWorkspaces (args, filters, cb) {
this.npm.log.warn('config', 'This command does not support workspaces.')
this.exec(args, cb)
}

Expand Down
12 changes: 11 additions & 1 deletion test/lib/config.js
Expand Up @@ -54,6 +54,7 @@ const cliConfig = {

const npm = {
log: {
warn: () => null,
info: () => null,
enableProgress: () => null,
disableProgress: () => null,
Expand Down Expand Up @@ -94,8 +95,17 @@ t.test('config no args', t => {
})

t.test('config ignores workspaces', t => {
npm.log.warn = (title, msg) => {
t.equal(title, 'config', 'should warn with expected title')
t.equal(
msg,
'This command does not support workspaces.',
'should warn with unsupported option msg'
)
}
config.execWorkspaces([], [], (err) => {
t.match(err, /usage instructions/, 'should not error out when workspaces are defined')
npm.log.warn = () => null
t.end()
})
})
Expand Down Expand Up @@ -396,7 +406,7 @@ t.test('config set invalid key', t => {
npm.config.validate = npmConfigValidate
delete npm.config.save
delete npm.config.set
delete npm.log.warn
npm.log.warn = () => null
})

config.exec(['set', 'foo', 'bar'], (err) => {
Expand Down