diff options
author | Gar <gar+gh@danger.computer> | 2021-05-06 21:04:01 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-06 22:46:31 +0300 |
commit | 7773b401554fb0365001e8aaa93524d60cc021a6 (patch) | |
tree | ac39b4f8ebe393afa8197d03a23c22804e9a800e | |
parent | d84b1bd23244c80a49cc9d3edef56b5a102f7c36 (diff) |
fix(tests): reflect new libnpmexec logic
PR-URL: https://github.com/npm/cli/pull/3198
Credit: @wraithgar
Close: #3198
Reviewed-by: @nlf, @darcyclarke
-rw-r--r-- | test/lib/exec.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/lib/exec.js b/test/lib/exec.js index 5ecc73274..3d2da32a7 100644 --- a/test/lib/exec.js +++ b/test/lib/exec.js @@ -121,11 +121,15 @@ t.afterEach(() => { t.test('npx foo, bin already exists locally', t => { const path = t.testdir({ - foo: 'just some file', + node_modules: { + '.bin': { + foo: 'just some file', + }, + }, }) PROGRESS_IGNORED = true - npm.localBin = path + npm.localBin = resolve(path, 'node_modules', '.bin') exec.exec(['foo', 'one arg', 'two arg'], er => { t.error(er, 'npm exec') @@ -137,7 +141,7 @@ t.test('npx foo, bin already exists locally', t => { stdioString: true, event: 'npx', env: { - PATH: [path, ...PATH].join(delimiter), + PATH: [npm.localBin, ...PATH].join(delimiter), }, stdio: 'inherit', }]) @@ -147,11 +151,15 @@ t.test('npx foo, bin already exists locally', t => { t.test('npx foo, bin already exists globally', t => { const path = t.testdir({ - foo: 'just some file', + node_modules: { + '.bin': { + foo: 'just some file', + }, + }, }) PROGRESS_IGNORED = true - npm.globalBin = path + npm.globalBin = resolve(path, 'node_modules', '.bin') exec.exec(['foo', 'one arg', 'two arg'], er => { t.error(er, 'npm exec') @@ -163,7 +171,7 @@ t.test('npx foo, bin already exists globally', t => { stdioString: true, event: 'npx', env: { - PATH: [path, ...PATH].join(delimiter), + PATH: [npm.globalBin, ...PATH].join(delimiter), }, stdio: 'inherit', }]) |