@@ -77,8 +77,7 @@ function isMatch(specimen, pattern) {
77
77
*
78
78
* @param { string } filename
79
79
* @param { string[] } preamble scripts to run in XS start compartment
80
- * @param { boolean } verbose
81
- * @param { string? } titleMatch
80
+ * @param {{ verbose?: boolean, titleMatch?: string } } options
82
81
* @param {{
83
82
* spawnXSnap: (opts: object) => XSnap,
84
83
* bundleSource: (...args: [string, ...unknown[]]) => Promise<Bundle>,
@@ -94,8 +93,7 @@ function isMatch(specimen, pattern) {
94
93
async function runTestScript (
95
94
filename ,
96
95
preamble ,
97
- verbose ,
98
- titleMatch ,
96
+ { verbose, titleMatch } ,
99
97
{ spawnXSnap, bundleSource, resolve, dirname } ,
100
98
) {
101
99
const testBundle = await bundleSource ( filename , 'getExport' , { externals } ) ;
@@ -174,6 +172,7 @@ async function runTestScript(
174
172
175
173
for ( const name of testNames ) {
176
174
if ( titleMatch && ! isMatch ( name , titleMatch ) ) {
175
+ // eslint-disable-next-line no-continue
177
176
continue ;
178
177
}
179
178
assertionStatus = { ok : 0 , 'not ok' : 0 , SKIP : 0 } ;
@@ -232,8 +231,9 @@ async function avaConfig(args, options, { glob, readFile }) {
232
231
let debug = false ;
233
232
let verbose = false ;
234
233
let titleMatch ;
235
- let arg ;
236
- while ( arg = args . shift ( ) ) {
234
+ while ( args . length > 0 ) {
235
+ const arg = args . shift ( ) ;
236
+ assert . typeof ( arg , 'string' ) ;
237
237
switch ( arg ) {
238
238
case '--debug' :
239
239
debug = true ;
@@ -247,7 +247,7 @@ async function avaConfig(args, options, { glob, readFile }) {
247
247
titleMatch = args . shift ( ) ;
248
248
break ;
249
249
default :
250
- files . push ( arg )
250
+ files . push ( arg ) ;
251
251
}
252
252
}
253
253
const { packageFilename = 'package.json' } = options ;
@@ -313,11 +313,14 @@ export async function main(
313
313
args ,
314
314
{ bundleSource, spawn, osType, readFile, resolve, dirname, glob } ,
315
315
) {
316
- const { files, require, exclude, debug, verbose, titleMatch } = await avaConfig (
317
- args ,
318
- { } ,
319
- { readFile, glob } ,
320
- ) ;
316
+ const {
317
+ files,
318
+ require,
319
+ exclude,
320
+ debug,
321
+ verbose,
322
+ titleMatch,
323
+ } = await avaConfig ( args , { } , { readFile, glob } ) ;
321
324
322
325
/** @param {Record<string, unknown> } opts */
323
326
const spawnXSnap = opts =>
@@ -367,12 +370,17 @@ export async function main(
367
370
console . log ( '# test script:' , filename ) ;
368
371
}
369
372
370
- const results = await runTestScript ( filename , preamble , debug , titleMatch , {
371
- spawnXSnap,
372
- bundleSource,
373
- resolve,
374
- dirname,
375
- } ) ;
373
+ const results = await runTestScript (
374
+ filename ,
375
+ preamble ,
376
+ { verbose, titleMatch } ,
377
+ {
378
+ spawnXSnap,
379
+ bundleSource,
380
+ resolve,
381
+ dirname,
382
+ } ,
383
+ ) ;
376
384
377
385
stats . total += results . total ;
378
386
stats . pass += results . pass ;
0 commit comments