Skip to content

Commit 88cbc8c

Browse files
committed
fix(tests): reflect new libnpmexec logic
PR-URL: #3198 Credit: @wraithgar Close: #3198 Reviewed-by: @nlf, @darcyclarke
1 parent 59171f0 commit 88cbc8c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/lib/exec.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,15 @@ t.afterEach(() => {
121121

122122
t.test('npx foo, bin already exists locally', t => {
123123
const path = t.testdir({
124-
foo: 'just some file',
124+
node_modules: {
125+
'.bin': {
126+
foo: 'just some file',
127+
},
128+
},
125129
})
126130

127131
PROGRESS_IGNORED = true
128-
npm.localBin = path
132+
npm.localBin = resolve(path, 'node_modules', '.bin')
129133

130134
exec.exec(['foo', 'one arg', 'two arg'], er => {
131135
t.error(er, 'npm exec')
@@ -137,7 +141,7 @@ t.test('npx foo, bin already exists locally', t => {
137141
stdioString: true,
138142
event: 'npx',
139143
env: {
140-
PATH: [path, ...PATH].join(delimiter),
144+
PATH: [npm.localBin, ...PATH].join(delimiter),
141145
},
142146
stdio: 'inherit',
143147
}])
@@ -147,11 +151,15 @@ t.test('npx foo, bin already exists locally', t => {
147151

148152
t.test('npx foo, bin already exists globally', t => {
149153
const path = t.testdir({
150-
foo: 'just some file',
154+
node_modules: {
155+
'.bin': {
156+
foo: 'just some file',
157+
},
158+
},
151159
})
152160

153161
PROGRESS_IGNORED = true
154-
npm.globalBin = path
162+
npm.globalBin = resolve(path, 'node_modules', '.bin')
155163

156164
exec.exec(['foo', 'one arg', 'two arg'], er => {
157165
t.error(er, 'npm exec')
@@ -163,7 +171,7 @@ t.test('npx foo, bin already exists globally', t => {
163171
stdioString: true,
164172
event: 'npx',
165173
env: {
166-
PATH: [path, ...PATH].join(delimiter),
174+
PATH: [npm.globalBin, ...PATH].join(delimiter),
167175
},
168176
stdio: 'inherit',
169177
}])

0 commit comments

Comments
 (0)