@@ -16,11 +16,6 @@ const OPTS = {
16
16
17
17
const REG = OPTS . registry
18
18
19
- // TODO this ... smells. npm "script-shell" config mentions defaults but those
20
- // are handled by run-script, not npm. So for now we have to tie tests to some
21
- // pretty specific internals of runScript
22
- const makeSpawnArgs = require ( '@npmcli/run-script/lib/make-spawn-args.js' )
23
-
24
19
t . test ( 'packs from local directory' , async t => {
25
20
const testDir = t . testdir ( {
26
21
'package.json' : JSON . stringify ( {
@@ -152,13 +147,15 @@ t.test('runs scripts in foreground when foregroundScripts === true', async t =>
152
147
const cwd = process . cwd ( )
153
148
process . chdir ( testDir )
154
149
155
- const [ scriptShell , scriptArgs ] = makeSpawnArgs ( {
156
- event : 'prepack' ,
157
- path : testDir ,
158
- cmd : 'touch prepack' ,
159
- } )
150
+ const shell = process . platform === 'win32'
151
+ ? process . env . COMSPEC
152
+ : 'sh'
153
+
154
+ const args = process . platform === 'win32'
155
+ ? [ '/d' , '/s' , '/c' , 'touch prepack' ]
156
+ : [ '-c' , 'touch prepack' ]
160
157
161
- const prepack = spawk . spawn ( scriptShell , scriptArgs )
158
+ const prepack = spawk . spawn ( shell , args )
162
159
163
160
await pack ( 'file:.' , {
164
161
packDestination : testDir ,
@@ -186,13 +183,7 @@ t.test('doesn\'t run scripts when ignoreScripts === true', async t => {
186
183
const cwd = process . cwd ( )
187
184
process . chdir ( testDir )
188
185
189
- const [ scriptShell , scriptArgs ] = makeSpawnArgs ( {
190
- event : 'prepack' ,
191
- path : testDir ,
192
- cmd : 'touch prepack' ,
193
- } )
194
-
195
- const prepack = spawk . spawn ( scriptShell , scriptArgs )
186
+ const prepack = spawk . spawn ( 'sh' , [ '-c' , 'touch prepack' ] )
196
187
197
188
await pack ( 'file:.' , {
198
189
packDestination : testDir ,
0 commit comments