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(tests): reflect new libnpmexec logic #3198

Merged
merged 1 commit into from May 6, 2021
Merged
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
20 changes: 14 additions & 6 deletions test/lib/exec.js
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