11import { parse } from "@optique/core/parser" ;
2- import { deepStrictEqual , ok , strictEqual } from "node:assert/strict" ;
2+ import { ok , strictEqual } from "node:assert/strict" ;
33import test from "node:test" ;
4- import { isSkipInstall , withSkipInstallArgs } from "./action/utils.ts" ;
4+ import { isSkipInstall } from "./action/utils.ts" ;
55import { initOptions } from "./command.ts" ;
66
77test ( "initOptions parses --skip-install as true" , ( ) => {
@@ -24,62 +24,3 @@ test("isSkipInstall mirrors the skipInstall field", () => {
2424 strictEqual ( isSkipInstall ( { skipInstall : false } ) , false ) ;
2525 strictEqual ( isSkipInstall ( { skipInstall : true } ) , true ) ;
2626} ) ;
27-
28- test ( "withSkipInstallArgs returns command unchanged when skipInstall is false" , ( ) => {
29- deepStrictEqual (
30- withSkipInstallArgs ( {
31- initializer : {
32- command : [ "npx" , "create-next-app" , "." ] ,
33- skipInstallArgs : [ "--skip-install" ] ,
34- } ,
35- skipInstall : false ,
36- } ) ,
37- [ "npx" , "create-next-app" , "." ] ,
38- ) ;
39- } ) ;
40-
41- test ( "withSkipInstallArgs returns command unchanged when args are absent" , ( ) => {
42- deepStrictEqual (
43- withSkipInstallArgs ( {
44- initializer : { command : [ "npx" , "create-next-app" , "." ] } ,
45- skipInstall : true ,
46- } ) ,
47- [ "npx" , "create-next-app" , "." ] ,
48- ) ;
49- deepStrictEqual (
50- withSkipInstallArgs ( {
51- initializer : {
52- command : [ "npx" , "create-next-app" , "." ] ,
53- skipInstallArgs : [ ] ,
54- } ,
55- skipInstall : true ,
56- } ) ,
57- [ "npx" , "create-next-app" , "." ] ,
58- ) ;
59- } ) ;
60-
61- test ( "withSkipInstallArgs appends args when command has no `&&`" , ( ) => {
62- deepStrictEqual (
63- withSkipInstallArgs ( {
64- initializer : {
65- command : [ "npx" , "create-next-app" , "." , "--yes" ] ,
66- skipInstallArgs : [ "--skip-install" ] ,
67- } ,
68- skipInstall : true ,
69- } ) ,
70- [ "npx" , "create-next-app" , "." , "--yes" , "--skip-install" ] ,
71- ) ;
72- } ) ;
73-
74- test ( "withSkipInstallArgs injects args before the first `&&`" , ( ) => {
75- deepStrictEqual (
76- withSkipInstallArgs ( {
77- initializer : {
78- command : [ "npx" , "create-foo" , "." , "&&" , "rm" , "foo.config.ts" ] ,
79- skipInstallArgs : [ "--no-install" ] ,
80- } ,
81- skipInstall : true ,
82- } ) ,
83- [ "npx" , "create-foo" , "." , "--no-install" , "&&" , "rm" , "foo.config.ts" ] ,
84- ) ;
85- } ) ;
0 commit comments