@@ -121,11 +121,15 @@ t.afterEach(() => {
121
121
122
122
t . test ( 'npx foo, bin already exists locally' , t => {
123
123
const path = t . testdir ( {
124
- foo : 'just some file' ,
124
+ node_modules : {
125
+ '.bin' : {
126
+ foo : 'just some file' ,
127
+ } ,
128
+ } ,
125
129
} )
126
130
127
131
PROGRESS_IGNORED = true
128
- npm . localBin = path
132
+ npm . localBin = resolve ( path , 'node_modules' , '.bin' )
129
133
130
134
exec . exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
131
135
t . error ( er , 'npm exec' )
@@ -137,7 +141,7 @@ t.test('npx foo, bin already exists locally', t => {
137
141
stdioString : true ,
138
142
event : 'npx' ,
139
143
env : {
140
- PATH : [ path , ...PATH ] . join ( delimiter ) ,
144
+ PATH : [ npm . localBin , ...PATH ] . join ( delimiter ) ,
141
145
} ,
142
146
stdio : 'inherit' ,
143
147
} ] )
@@ -147,11 +151,15 @@ t.test('npx foo, bin already exists locally', t => {
147
151
148
152
t . test ( 'npx foo, bin already exists globally' , t => {
149
153
const path = t . testdir ( {
150
- foo : 'just some file' ,
154
+ node_modules : {
155
+ '.bin' : {
156
+ foo : 'just some file' ,
157
+ } ,
158
+ } ,
151
159
} )
152
160
153
161
PROGRESS_IGNORED = true
154
- npm . globalBin = path
162
+ npm . globalBin = resolve ( path , 'node_modules' , '.bin' )
155
163
156
164
exec . exec ( [ 'foo' , 'one arg' , 'two arg' ] , er => {
157
165
t . error ( er , 'npm exec' )
@@ -163,7 +171,7 @@ t.test('npx foo, bin already exists globally', t => {
163
171
stdioString : true ,
164
172
event : 'npx' ,
165
173
env : {
166
- PATH : [ path , ...PATH ] . join ( delimiter ) ,
174
+ PATH : [ npm . globalBin , ...PATH ] . join ( delimiter ) ,
167
175
} ,
168
176
stdio : 'inherit' ,
169
177
} ] )
0 commit comments