Skip to content

Commit

Permalink
Merge pull request #2176 from jerch/single_testfile_argument
Browse files Browse the repository at this point in the history
ability to inject particular testfile to yarn test
  • Loading branch information
jerch committed Jun 2, 2019
2 parents c8e2673 + 9b6e182 commit 35df028
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions bin/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,26 @@ const path = require('path');
const env = { ...process.env };
env.NODE_PATH = path.resolve(__dirname, '../out');

const args = [
let testFiles = [
'./out/*test.js',
'./out/**/*test.js',
'./out/*integration.js',
'./out/**/*integration.js',
'./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 ...]
if (process.argv.length > 2) {
testFiles = process.argv.slice(2);
}

cp.spawnSync(
path.resolve(__dirname, '../node_modules/.bin/mocha'),
testFiles,
{
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit'
}
);

0 comments on commit 35df028

Please sign in to comment.