diff options
Diffstat (limited to 'deps/npm/test/lib/npm.js')
-rw-r--r-- | deps/npm/test/lib/npm.js | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index 6f8f8936d3f..6909c43e4ff 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -355,7 +355,7 @@ t.test('npm.load', t => { await new Promise((res) => setTimeout(res)) }) - t.test('workpaces-aware configs and commands', async t => { + t.test('workspace-aware configs and commands', async t => { const dir = t.testdir({ packages: { a: { @@ -438,6 +438,60 @@ t.test('npm.load', t => { }) }) + t.test('workspaces in global mode', async t => { + const dir = t.testdir({ + packages: { + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + scripts: { test: 'echo test a' }, + }), + }, + b: { + 'package.json': JSON.stringify({ + name: 'b', + version: '1.0.0', + scripts: { test: 'echo test b' }, + }), + }, + }, + 'package.json': JSON.stringify({ + name: 'root', + version: '1.0.0', + workspaces: ['./packages/*'], + }), + }) + const { execPath } = process + freshConfig({ + argv: [ + execPath, + process.argv[1], + '--userconfig', + resolve(dir, '.npmrc'), + '--color', + 'false', + '--workspaces', + '--global', + 'true', + ], + }) + await npm.load(er => { + if (er) + throw er + }) + npm.localPrefix = dir + await new Promise((res, rej) => { + // verify that calling the command with a short name still sets + // the npm.command property to the full canonical name of the cmd. + npm.command = null + npm.commands.run([], er => { + t.match(er, /Workspaces not supported for global packages/) + res() + }) + }) + }) + t.end() }) |