Skip to content

Commit 4f60df1

Browse files
committed
style(ava-xs): lint fixes
1 parent e89f1e1 commit 4f60df1

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

packages/xsnap/src/avaXS.js

+26-18
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ function isMatch(specimen, pattern) {
7777
*
7878
* @param { string } filename
7979
* @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
8281
* @param {{
8382
* spawnXSnap: (opts: object) => XSnap,
8483
* bundleSource: (...args: [string, ...unknown[]]) => Promise<Bundle>,
@@ -94,8 +93,7 @@ function isMatch(specimen, pattern) {
9493
async function runTestScript(
9594
filename,
9695
preamble,
97-
verbose,
98-
titleMatch,
96+
{ verbose, titleMatch },
9997
{ spawnXSnap, bundleSource, resolve, dirname },
10098
) {
10199
const testBundle = await bundleSource(filename, 'getExport', { externals });
@@ -174,6 +172,7 @@ async function runTestScript(
174172

175173
for (const name of testNames) {
176174
if (titleMatch && !isMatch(name, titleMatch)) {
175+
// eslint-disable-next-line no-continue
177176
continue;
178177
}
179178
assertionStatus = { ok: 0, 'not ok': 0, SKIP: 0 };
@@ -232,8 +231,9 @@ async function avaConfig(args, options, { glob, readFile }) {
232231
let debug = false;
233232
let verbose = false;
234233
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');
237237
switch (arg) {
238238
case '--debug':
239239
debug = true;
@@ -247,7 +247,7 @@ async function avaConfig(args, options, { glob, readFile }) {
247247
titleMatch = args.shift();
248248
break;
249249
default:
250-
files.push(arg)
250+
files.push(arg);
251251
}
252252
}
253253
const { packageFilename = 'package.json' } = options;
@@ -313,11 +313,14 @@ export async function main(
313313
args,
314314
{ bundleSource, spawn, osType, readFile, resolve, dirname, glob },
315315
) {
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 });
321324

322325
/** @param {Record<string, unknown>} opts */
323326
const spawnXSnap = opts =>
@@ -367,12 +370,17 @@ export async function main(
367370
console.log('# test script:', filename);
368371
}
369372

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+
);
376384

377385
stats.total += results.total;
378386
stats.pass += results.pass;

0 commit comments

Comments
 (0)