Update test-unit to allow double dash args
This commit is contained in:
+12
-5
@@ -15,15 +15,22 @@ let testFiles = [
|
|||||||
'./out/**/*test.js'
|
'./out/**/*test.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
// ability to inject particular test files via
|
let flagArgs = [];
|
||||||
// yarn test [testFileA testFileB ...]
|
|
||||||
if (process.argv.length > 2) {
|
if (process.argv.length > 2) {
|
||||||
testFiles = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
|
flagArgs = args.filter(e => e.startsWith('--'));
|
||||||
|
// ability to inject particular test files via
|
||||||
|
// yarn test [testFileA testFileB ...]
|
||||||
|
files = args.filter(e => !e.startsWith('--'));
|
||||||
|
if(files.length){
|
||||||
|
testFiles = files;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const run = cp.spawnSync(
|
const run = cp.spawnSync(
|
||||||
path.resolve(__dirname, '../node_modules/.bin/mocha'),
|
path.resolve(__dirname, '../node_modules/.bin/mocha'),
|
||||||
testFiles,
|
[...testFiles, ...flagArgs],
|
||||||
{
|
{
|
||||||
cwd: path.resolve(__dirname, '..'),
|
cwd: path.resolve(__dirname, '..'),
|
||||||
env,
|
env,
|
||||||
@@ -31,4 +38,4 @@ const run = cp.spawnSync(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
process.exit(run.status);
|
process.exit(run.status);
|
||||||
|
|||||||
Reference in New Issue
Block a user