diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-24 23:04:53 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-25 00:03:36 +0300 |
commit | 7b45e9df6102c7bd6e403d1fdc9939581c38f546 (patch) | |
tree | 78f39064285694a162acd231bea1987b1beee581 /test | |
parent | e544f8cd21b6046859f30e056729414cd048405b (diff) |
fix: npm config warn on workspaces
When a workspace/workspaces config option is defined, we should log a
warning message to be explicit about not supporting workspaces in the
context of the `npm config` command.
PR-URL: https://github.com/npm/cli/pull/2950
Credit: @ruyadorno
Close: #2950
Reviewed-by: @wraithgar
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/config.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/lib/config.js b/test/lib/config.js index 98ece0f4f..074db9765 100644 --- a/test/lib/config.js +++ b/test/lib/config.js @@ -54,6 +54,7 @@ const cliConfig = { const npm = { log: { + warn: () => null, info: () => null, enableProgress: () => null, disableProgress: () => null, @@ -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() }) }) @@ -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) => { |