Skip to content

Commit

Permalink
fix(tests): reflect new libnpmexec logic
Browse files Browse the repository at this point in the history
PR-URL: #3198
Credit: @wraithgar
Close: #3198
Reviewed-by: @nlf, @darcyclarke
  • Loading branch information
wraithgar committed May 6, 2021
1 parent 59171f0 commit 88cbc8c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/lib/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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',
}])
Expand All @@ -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')
Expand All @@ -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',
}])
Expand Down

0 comments on commit 88cbc8c

Please sign in to comment.