From 0d93f6f4964c7d76356c2f2b7cfce7535ae7f578 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 8 Sep 2026 14:25:21 +0200 Subject: [PATCH] fix: restore test execution and CLI compatibility --- args.js | 1 + suite-runner.js | 37 ++++++++++++++++++++++++++++--------- test/args.test.js | 12 ++++++++++++ 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/args.js b/args.js index e877f675..89422318 100644 --- a/args.js +++ b/args.js @@ -51,6 +51,7 @@ const CLI_OPTIONS = { 'common-prefix': { type: 'boolean' }, 'include-hooks': { type: 'boolean' }, 'trust-proxy-enabled': { type: 'boolean' }, + yaml: { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, 'debug-port': { type: 'string', short: 'I' } } diff --git a/suite-runner.js b/suite-runner.js index 66c2b5fc..9a58132e 100644 --- a/suite-runner.js +++ b/suite-runner.js @@ -5,21 +5,40 @@ const { glob } = require('glob') const pattern = process.argv[process.argv.length - 1] -console.info(`Running tests matching ${pattern}`) -const timeout = 10 * 60 * 1000 // 10 minutes -glob(pattern, { ignore: ['**/node_modules/**', 'test/workdir*/**'] }).then((matches) => { +async function main () { + console.info(`Running tests matching ${pattern}`) + const timeout = 10 * 60 * 1000 // 10 minutes + const matches = await glob(pattern, { + ignore: ['**/node_modules/**', 'test/workdir*/**'] + }) if (matches.length === 0) { - console.error(`No test files matched ${pattern}`) - process.exit(1) + throw new Error(`No test files matched ${pattern}`) } + const resolved = matches.map(file => path.resolve(file)) - const testRs = run({ files: resolved, timeout, concurrency: 1 }) + const runOptions = { + files: resolved, + timeout, + concurrency: 1 + } + if (pattern.endsWith('.ts') && process.execArgv.some(arg => arg.includes('ts-node/esm'))) { + runOptions.isolation = 'none' + } + + const testRs = run(runOptions) .on('test:fail', () => { process.exitCode = 1 }) .compose(spec) - testRs.pipe(process.stdout) -}, (err) => { + + await new Promise((resolve, reject) => { + testRs.once('error', reject) + testRs.once('end', resolve) + testRs.pipe(process.stdout, { end: false }) + }) +} + +main().catch(err => { console.error(err) - process.exit(1) + process.exitCode = 1 }) diff --git a/test/args.test.js b/test/args.test.js index 1f924742..b2f36684 100644 --- a/test/args.test.js +++ b/test/args.test.js @@ -210,6 +210,18 @@ test('should parse env vars correctly', t => { }) }) +test('should preserve explicit false boolean values', t => { + const parsedArgs = parseArgs([ + '--watch=false', + '--pretty-logs', 'false', + 'app.js' + ]) + + t.assert.strictEqual(parsedArgs.watch, false) + t.assert.strictEqual(parsedArgs.prettyLogs, false) + t.assert.deepStrictEqual(parsedArgs._, ['app.js']) +}) + test('should respect default values', t => { t.plan(14)