ability to inject particular testfile to yarn test

This commit is contained in:
Jörg Breitbart
2019-06-02 21:27:48 +02:00
parent c8e267334d
commit 21bad6b974
+13 -5
View File
@@ -18,8 +18,16 @@ const args = [
'./lib/**/*test.js'
];
cp.spawnSync(path.resolve(__dirname, '../node_modules/.bin/mocha'), args, {
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit'
});
// ability to inject particular test files via
// yarn test [testFileA testFileB ...]
const testFilesFromArgs = process.argv.slice(2);
cp.spawnSync(
path.resolve(__dirname, '../node_modules/.bin/mocha'),
(testFilesFromArgs.length) ? testFilesFromArgs : args,
{
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit'
}
);