@@ -6,7 +6,7 @@ import { join, resolve } from '../../src/util/path.js';
6
6
7
7
const cwd = resolve ( 'fixtures/binaries' ) ;
8
8
const containingFilePath = join ( cwd , 'package.json' ) ;
9
- const pkgScripts = { cwd, manifestScriptNames : new Set ( [ 'program' ] ) } ;
9
+ const pkgScripts = { cwd, manifestScriptNames : new Set ( [ 'program' , 'spl:t' ] ) } ;
10
10
const knownOnly = { cwd, knownBinsOnly : true } ;
11
11
const optional = { optional : true } ;
12
12
@@ -125,63 +125,63 @@ test('getInputsFromScripts (nx)', () => {
125
125
} ) ;
126
126
127
127
test ( 'getInputsFromScripts (npm)' , ( ) => {
128
- t ( 'npm run script' , [ toBinary ( 'npm' ) ] ) ;
129
- t ( 'npm run publish:latest -- --npm-tag=debug --no-push' , [ toBinary ( 'npm' ) ] ) ;
130
- t ( 'npm exec -- vitest -c vitest.e2e.config.mts' , [ toBinary ( 'npm' ) , toBinary ( ' vitest') , toConfig ( 'vitest' , 'vitest.e2e.config.mts' , containingFilePath ) ] ) ;
128
+ t ( 'npm run script' , [ ] ) ;
129
+ t ( 'npm run publish:latest -- --npm-tag=debug --no-push' , [ ] ) ;
130
+ t ( 'npm exec -- vitest -c vitest.e2e.config.mts' , [ toBinary ( 'vitest' ) , toConfig ( 'vitest' , 'vitest.e2e.config.mts' , containingFilePath ) ] ) ;
131
131
} ) ;
132
132
133
133
test ( 'getInputsFromScripts (npx)' , ( ) => {
134
- t ( 'npx pkg' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
135
- t ( 'npx prisma migrate reset --force' , [ toBinary ( 'npx' ) , toBinary ( ' prisma') ] ) ;
136
- t ( 'npx @scope/pkg' , [ toBinary ( 'npx' ) , toDependency ( '@scope/pkg' , optional ) ] ) ;
137
- t ( 'npx tsx watch main' , [ toBinary ( 'npx' ) , toBinary ( ' tsx') , toDeferResolveEntry ( 'main' ) ] ) ;
138
- t ( 'npx -y pkg' , [ toBinary ( 'npx' ) ] ) ;
139
- t ( 'npx --yes pkg' , [ toBinary ( 'npx' ) ] ) ;
140
- t ( 'npx --no pkg --edit ${1}' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
141
- t ( 'npx --no -- pkg --edit ${1}' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
142
- t ( 'npx pkg install --with-deps' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
143
- t ( 'npx pkg migrate reset --force' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
144
- t ( 'npx pkg@1.0.0 migrate reset --force' , [ toBinary ( 'npx' ) , toDependency ( 'pkg' , optional ) ] ) ;
145
- t ( 'npx @scope/cli migrate reset --force' , [ toBinary ( 'npx' ) , toDependency ( '@scope/cli' , optional ) ] ) ;
146
- t ( 'npx -- pkg' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') ] ) ;
147
- t ( 'npx -- @scope/cli@1.0.0 migrate reset --force' , [ toBinary ( 'npx' ) , toDependency ( '@scope/cli' , optional ) ] ) ;
148
- t ( 'npx retry-cli@0.6.0 -- curl --output /dev/null ' , [ toBinary ( 'npx' ) , toDependency ( 'retry-cli' , optional ) , toBinary ( 'curl' ) ] ) ;
149
- t ( 'npx --package pkg@0.6.0 -- curl --output /dev/null' , [ toBinary ( 'npx' ) , toBinary ( ' curl') , toDependency ( 'pkg' , optional ) ] ) ;
150
- t ( 'npx --package @scope/pkg@0.6.0 --package pkg -- curl' , [ toBinary ( 'npx' ) , toBinary ( ' curl') , toDependency ( '@scope/pkg' , optional ) , toDependency ( 'pkg' , optional ) ] ) ;
151
- t ( "npx --package=foo -c 'curl --output /dev/null'" , [ toBinary ( 'npx' ) , toDependency ( 'foo' , optional ) , toBinary ( 'curl' ) ] ) ;
152
- t ( 'npx swagger-typescript-api -p http://localhost:3030/swagger.v1.json' , [ toBinary ( 'npx' ) , toBinary ( ' swagger-typescript-api') ] ) ;
153
- t ( 'npx swagger-typescript-api -- -p http://localhost:3030/swagger.v1.json' , [ toBinary ( 'npx' ) , toBinary ( ' swagger-typescript-api') ] ) ;
154
- t ( 'npx tsx main' , [ toBinary ( 'npx' ) , toBinary ( ' tsx') , toDeferResolveEntry ( 'main' ) ] ) ;
155
- t ( 'npx tsx ./main.ts build' , [ toBinary ( 'npx' ) , toBinary ( ' tsx') , ts ] ) ;
156
- t ( 'npx tsx ./main.ts -- build' , [ toBinary ( 'npx' ) , toBinary ( ' tsx') , ts ] ) ;
134
+ t ( 'npx pkg' , [ toBinary ( 'pkg' ) ] ) ;
135
+ t ( 'npx prisma migrate reset --force' , [ toBinary ( 'prisma' ) ] ) ;
136
+ t ( 'npx @scope/pkg' , [ toDependency ( '@scope/pkg' , optional ) ] ) ;
137
+ t ( 'npx tsx watch main' , [ toBinary ( 'tsx' ) , toDeferResolveEntry ( 'main' ) ] ) ;
138
+ t ( 'npx -y pkg' , [ ] ) ;
139
+ t ( 'npx --yes pkg' , [ ] ) ;
140
+ t ( 'npx --no pkg --edit ${1}' , [ toBinary ( 'pkg' ) ] ) ;
141
+ t ( 'npx --no -- pkg --edit ${1}' , [ toBinary ( 'pkg' ) ] ) ;
142
+ t ( 'npx pkg install --with-deps' , [ toBinary ( 'pkg' ) ] ) ;
143
+ t ( 'npx pkg migrate reset --force' , [ toBinary ( 'pkg' ) ] ) ;
144
+ t ( 'npx pkg@1.0.0 migrate reset --force' , [ toDependency ( 'pkg' , optional ) ] ) ;
145
+ t ( 'npx @scope/cli migrate reset --force' , [ toDependency ( '@scope/cli' , optional ) ] ) ;
146
+ t ( 'npx -- pkg' , [ toBinary ( 'pkg' ) ] ) ;
147
+ t ( 'npx -- @scope/cli@1.0.0 migrate reset --force' , [ toDependency ( '@scope/cli' , optional ) ] ) ;
148
+ t ( 'npx retry-cli@0.6.0 -- curl --output /dev/null ' , [ toDependency ( 'retry-cli' , optional ) , toBinary ( 'curl' ) ] ) ;
149
+ t ( 'npx --package pkg@0.6.0 -- curl --output /dev/null' , [ toBinary ( 'curl' ) , toDependency ( 'pkg' , optional ) ] ) ;
150
+ t ( 'npx --package @scope/pkg@0.6.0 --package pkg -- curl' , [ toBinary ( 'curl' ) , toDependency ( '@scope/pkg' , optional ) , toDependency ( 'pkg' , optional ) ] ) ;
151
+ t ( "npx --package=foo -c 'curl --output /dev/null'" , [ toDependency ( 'foo' , optional ) , toBinary ( 'curl' ) ] ) ;
152
+ t ( 'npx swagger-typescript-api -p http://localhost:3030/swagger.v1.json' , [ toBinary ( 'swagger-typescript-api' ) ] ) ;
153
+ t ( 'npx swagger-typescript-api -- -p http://localhost:3030/swagger.v1.json' , [ toBinary ( 'swagger-typescript-api' ) ] ) ;
154
+ t ( 'npx tsx main' , [ toBinary ( 'tsx' ) , toDeferResolveEntry ( 'main' ) ] ) ;
155
+ t ( 'npx tsx ./main.ts build' , [ toBinary ( 'tsx' ) , ts ] ) ;
156
+ t ( 'npx tsx ./main.ts -- build' , [ toBinary ( 'tsx' ) , ts ] ) ;
157
157
} ) ;
158
158
159
159
test ( 'getInputsFromScripts (pnpx/pnpm dlx)' , ( ) => {
160
- t ( 'pnpx pkg' , [ toBinary ( 'pnpx' ) , toDependency ( 'pkg' , optional ) ] ) ;
161
- const s = [ toDependency ( 'cowsay' , optional ) , toDependency ( 'lolcatjs' , optional ) , toBinary ( 'echo' ) , toBinary ( 'cowsay' ) , toBinary ( 'lolcatjs' ) ] ;
162
- t ( 'pnpx --package cowsay --package lolcatjs -c \'echo "hi pnpm" | cowsay | lolcatjs\'' , [ toBinary ( 'pnpx' ) , ... s ] ) ;
163
- t ( 'pnpm --package cowsay --package lolcatjs -c dlx \'echo "hi pnpm" | cowsay | lolcatjs\'' , [ toBinary ( 'pnpm' ) , ... s ] ) ;
160
+ t ( 'pnpx pkg' , [ toDependency ( 'pkg' , optional ) ] ) ;
161
+ const inputs = [ toDependency ( 'cowsay' , optional ) , toDependency ( 'lolcatjs' , optional ) , toBinary ( 'echo' ) , toBinary ( 'cowsay' ) , toBinary ( 'lolcatjs' ) ] ;
162
+ t ( 'pnpx --package cowsay --package lolcatjs -c \'echo "hi pnpm" | cowsay | lolcatjs\'' , inputs ) ;
163
+ t ( 'pnpm --package cowsay --package lolcatjs -c dlx \'echo "hi pnpm" | cowsay | lolcatjs\'' , inputs ) ;
164
164
} ) ;
165
165
166
166
test ( 'getInputsFromScripts (bunx/bun x)' , ( ) => {
167
- t ( 'bunx pkg' , [ toBinary ( 'bunx' ) , toDependency ( 'pkg' , optional ) ] ) ;
168
- t ( 'bunx cowsay "Hello world!"' , [ toBinary ( 'bunx' ) , toDependency ( 'cowsay' , optional ) ] ) ;
169
- t ( 'bunx my-cli --foo bar' , [ toBinary ( 'bunx' ) , toDependency ( 'my-cli' , optional ) ] ) ;
170
- t ( 'bun x pkg' , [ toBinary ( 'bun' ) , toDependency ( 'pkg' , optional ) ] ) ;
167
+ t ( 'bunx pkg' , [ toDependency ( 'pkg' , optional ) ] ) ;
168
+ t ( 'bunx cowsay "Hello world!"' , [ toDependency ( 'cowsay' , optional ) ] ) ;
169
+ t ( 'bunx my-cli --foo bar' , [ toDependency ( 'my-cli' , optional ) ] ) ;
170
+ t ( 'bun x pkg' , [ toDependency ( 'pkg' , optional ) ] ) ;
171
171
} ) ;
172
172
173
173
test ( 'getInputsFromScripts (pnpm)' , ( ) => {
174
- t ( 'pnpm exec program' , [ toBinary ( 'pnpm' ) , toBinary ( ' program') ] ) ;
175
- t ( 'pnpm run program' , [ toBinary ( 'pnpm' ) ] ) ;
176
- t ( 'pnpm program' , [ toBinary ( 'pnpm' ) , toBinary ( ' program') ] ) ;
177
- t ( 'pnpm run program' , [ toBinary ( 'pnpm' ) ] , pkgScripts ) ;
178
- t ( 'pnpm program' , [ toBinary ( 'pnpm' ) ] , pkgScripts ) ;
179
- t ( 'pnpm dlx pkg' , [ toBinary ( 'pnpm' ) , toDependency ( 'pkg' , optional ) ] ) ;
180
- t ( 'pnpm --package=pkg-a dlx pkg' , [ toBinary ( 'pnpm' ) , toDependency ( 'pkg' , optional ) , toDependency ( 'pkg-a' , optional ) ] ) ;
181
- t ( 'pnpm --recursive --parallel test -- --sequence.seed=1700316221712' , [ toBinary ( 'pnpm' ) ] ) ;
182
- t ( 'pnpm program script.js' , [ toBinary ( 'pnpm' ) ] , pkgScripts ) ;
183
- t ( 'pnpm --silent program script.js' , [ toBinary ( 'pnpm' ) ] , pkgScripts ) ;
184
- t ( 'pnpm --silent run program script.js' , [ toBinary ( 'pnpm' ) ] , pkgScripts ) ;
174
+ t ( 'pnpm exec program' , [ toBinary ( 'program' ) ] ) ;
175
+ t ( 'pnpm run program' , [ ] ) ;
176
+ t ( 'pnpm program' , [ toBinary ( 'program' ) ] ) ;
177
+ t ( 'pnpm run program' , [ ] , pkgScripts ) ;
178
+ t ( 'pnpm program' , [ ] , pkgScripts ) ;
179
+ t ( 'pnpm dlx pkg' , [ toDependency ( 'pkg' , optional ) ] ) ;
180
+ t ( 'pnpm --package=pkg-a dlx pkg' , [ toDependency ( 'pkg' , optional ) , toDependency ( 'pkg-a' , optional ) ] ) ;
181
+ t ( 'pnpm --recursive --parallel test -- --sequence.seed=1700316221712' , [ ] ) ;
182
+ t ( 'pnpm program script.js' , [ ] , pkgScripts ) ;
183
+ t ( 'pnpm --silent program script.js' , [ ] , pkgScripts ) ;
184
+ t ( 'pnpm --silent run program script.js' , [ ] , pkgScripts ) ;
185
185
} ) ;
186
186
187
187
test ( 'getInputsFromScripts (yarn)' , ( ) => {
@@ -204,18 +204,18 @@ test('getInputsFromScripts (rollup)', () => {
204
204
205
205
test ( 'getInputsFromScripts (execa)' , ( ) => {
206
206
t ( 'execa --quiet ./script.js' , [ toBinary ( 'execa' ) , toDeferResolve ( './script.js' ) ] ) ;
207
- t ( 'npx --yes execa --quiet ./script.js' , [ toBinary ( 'npx' ) , toDeferResolve ( './script.js' ) ] ) ;
207
+ t ( 'npx --yes execa --quiet ./script.js' , [ toDeferResolve ( './script.js' ) ] ) ;
208
208
} ) ;
209
209
210
210
test ( 'getInputsFromScripts (zx)' , ( ) => {
211
211
t ( 'zx --quiet script.js' , [ toBinary ( 'zx' ) , toDeferResolve ( 'script.js' ) ] ) ;
212
- t ( 'npx --yes zx --quiet script.js' , [ toBinary ( 'npx' ) , toDeferResolve ( 'script.js' ) ] ) ;
212
+ t ( 'npx --yes zx --quiet script.js' , [ toDeferResolve ( 'script.js' ) ] ) ;
213
213
} ) ;
214
214
215
215
test ( 'getInputsFromScripts (c8)' , ( ) => {
216
216
t ( 'c8 node script.js' , [ toBinary ( 'c8' ) , toBinary ( 'node' ) , toDeferResolveEntry ( 'script.js' ) ] ) ;
217
- t ( 'c8 npm test' , [ toBinary ( 'c8' ) , toBinary ( 'npm' ) ] ) ;
218
- t ( 'c8 check-coverage --lines 95 --per-file npm test' , [ toBinary ( 'c8' ) , toBinary ( 'npm' ) ] ) ;
217
+ t ( 'c8 npm test' , [ toBinary ( 'c8' ) ] ) ;
218
+ t ( 'c8 check-coverage --lines 95 --per-file npm test' , [ toBinary ( 'c8' ) ] ) ;
219
219
t ( "c8 --reporter=lcov --reporter text mocha 'test/**/*.spec.js'" , [ toBinary ( 'c8' ) , toBinary ( 'mocha' ) ] ) ;
220
220
t ( 'c8 --reporter=lcov --reporter text node --test --test-reporter=@org/rep' , [ toBinary ( 'c8' ) , toBinary ( 'node' ) , toDeferResolve ( '@org/rep' ) ] ) ;
221
221
} ) ;
@@ -233,7 +233,7 @@ test('getInputsFromScripts (double-dash)', () => {
233
233
test ( 'getInputsFromScripts (bash expressions)' , ( ) => {
234
234
t ( 'if test "$NODE_ENV" = "production" ; then make install ; fi ' , [ toBinary ( 'make' ) ] ) ;
235
235
t ( 'node -e "if (NODE_ENV === \'production\'){process.exit(1)} " || make install' , [ toBinary ( 'node' ) , toBinary ( 'make' ) ] ) ;
236
- t ( 'if ! npx pkg --verbose ; then exit 1 ; fi' , [ toBinary ( 'npx' ) , toBinary ( ' pkg') , toBinary ( 'exit' ) ] ) ;
236
+ t ( 'if ! npx pkg --verbose ; then exit 1 ; fi' , [ toBinary ( 'pkg' ) , toBinary ( 'exit' ) ] ) ;
237
237
t ( 'exec < /dev/tty && node_modules/.bin/cz --hook || true' , [ toBinary ( 'exec' ) , toBinary ( 'cz' ) , toBinary ( 'true' ) ] ) ;
238
238
} ) ;
239
239
@@ -243,8 +243,8 @@ test('getInputsFromScripts (bash expansion)', () => {
243
243
} ) ;
244
244
245
245
test ( 'getInputsFromScripts (multiline)' , ( ) => {
246
- t ( '#!/bin/sh\n. "$(dirname "$0")/_/husky.sh"\nnpx lint-staged' , [ toBinary ( 'npx' ) , toBinary ( ' lint-staged') ] ) ;
247
- t ( `for S in "s"; do\n\tnpx rc@0.6.0\n\tnpx @scope/rc@0.6.0\ndone` , [ toBinary ( 'npx' ) , toDependency ( 'rc' , optional ) , toBinary ( 'npx' ) , toDependency ( '@scope/rc' , optional ) ] ) ;
246
+ t ( '#!/bin/sh\n. "$(dirname "$0")/_/husky.sh"\nnpx lint-staged' , [ toBinary ( 'lint-staged' ) ] ) ;
247
+ t ( `for S in "s"; do\n\tnpx rc@0.6.0\n\tnpx @scope/rc@0.6.0\ndone` , [ toDependency ( 'rc' , optional ) , toDependency ( '@scope/rc' , optional ) ] ) ;
248
248
} ) ;
249
249
250
250
test ( 'getInputsFromScripts (bail outs)' , ( ) => {
0 commit comments