Skip to content

Commit

Permalink
Get Windows unit tests running again
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Nov 6, 2019
1 parent 48b20e3 commit fe2f1ea
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bin/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const checkCoverage = flagArgs.indexOf('--coverage') >= 0;

if (checkCoverage) {
flagArgs.splice(flagArgs.indexOf('--coverage'), 1);
const executable = path.resolve(__dirname, '../node_modules/.bin/nyc');
const args = ['--check-coverage', `--lines=${COVERAGE_LINES_THRESHOLD}`, path.resolve(__dirname, '../node_modules/.bin/mocha'), ...testFiles, ...flagArgs];
const executable = npmBinScript('nyc');
const args = ['--check-coverage', `--lines=${COVERAGE_LINES_THRESHOLD}`, npmBinScript('mocha'), ...testFiles, ...flagArgs];
console.info('executable', executable);
console.info('args', args);
const run = cp.spawnSync(
Expand All @@ -51,12 +51,17 @@ if (checkCoverage) {
}

const run = cp.spawnSync(
path.resolve(__dirname, '../node_modules/.bin/mocha'),
npmBinScript('mocha'),
[...testFiles, ...flagArgs],
{
cwd: path.resolve(__dirname, '..'),
env,
stdio: 'inherit'
}
);

function npmBinScript(script) {
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? `${script}.cmd` : script));
}

process.exit(run.status);

0 comments on commit fe2f1ea

Please sign in to comment.