@@ -61,7 +61,39 @@ function ensureLocalVintaSend(pkgJson, localSpec) {
6161const repoRoot = process . cwd ( ) ;
6262const implementationsRoot = path . join ( repoRoot , "src" , "implementations" ) ;
6363const originalContents = new Map ( ) ;
64- const requestedImplementations = process . argv . slice ( 2 ) ;
64+
65+ function parseArgs ( argv ) {
66+ let command = "test" ;
67+ const implementations = [ ] ;
68+
69+ for ( let i = 0 ; i < argv . length ; i += 1 ) {
70+ const arg = argv [ i ] ;
71+
72+ if ( arg . startsWith ( "--command=" ) ) {
73+ command = arg . slice ( "--command=" . length ) ;
74+ continue ;
75+ }
76+
77+ if ( arg === "--command" ) {
78+ const next = argv [ i + 1 ] ;
79+ if ( ! next ) {
80+ throw new Error ( "Missing value for --command" ) ;
81+ }
82+
83+ command = next ;
84+ i += 1 ;
85+ continue ;
86+ }
87+
88+ implementations . push ( arg ) ;
89+ }
90+
91+ return { command, implementations } ;
92+ }
93+
94+ const { command, implementations : requestedImplementations } = parseArgs (
95+ process . argv . slice ( 2 ) ,
96+ ) ;
6597
6698const allImplementationDirs = fs
6799 . readdirSync ( implementationsRoot , { withFileTypes : true } )
@@ -99,6 +131,7 @@ if (implementationDirs.length === 0) {
99131}
100132
101133try {
134+ console . log ( `Running implementation script: ${ command } ` ) ;
102135 console . log ( "Building local vintasend..." ) ;
103136 run ( "npm" , [ "run" , "build" ] , repoRoot ) ;
104137
@@ -117,9 +150,9 @@ try {
117150
118151 for ( const packageDir of implementationDirs ) {
119152 const name = path . basename ( packageDir ) ;
120- console . log ( `\nTesting ${ name } with local vintasend...` ) ;
153+ console . log ( `\nRunning ${ command } on ${ name } with local vintasend...` ) ;
121154 run ( "npm" , [ "install" , "--no-package-lock" ] , packageDir ) ;
122- run ( "npm" , [ "test" ] , packageDir ) ;
155+ run ( "npm" , [ "run" , command ] , packageDir ) ;
123156 }
124157} catch ( error ) {
125158 console . error ( error instanceof Error ? error . message : error ) ;
0 commit comments