node/test/fixtures/test-runner-watch.mjs
Pietro Marchini 1c7795e52e
test_runner: add cwd option to run
PR-URL: https://github.com/nodejs/node/pull/54705
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2024-10-03 15:45:49 +00:00

43 lines
608 B
JavaScript

import { run } from 'node:test';
import { tap } from 'node:test/reporters';
import { parseArgs } from 'node:util';
const options = {
file: {
type: 'string',
},
cwd: {
type: 'string',
},
isolation: {
type: 'string',
},
};
const {
values,
positionals,
} = parseArgs({ args: process.argv.slice(2), options });
let files;
let cwd;
let isolation;
if (values.file) {
files = [values.file];
}
if (values.cwd) {
cwd = values.cwd;
}
if (values.isolation) {
isolation = values.isolation;
}
run({
files,
watch: true,
cwd,
isolation,
}).compose(tap).pipe(process.stdout);