Get Windows unit tests running again

Fixes #2543
This commit is contained in:
Daniel Imms
2019-11-06 11:20:52 -08:00
parent 48b20e3200
commit fe2f1ea4df
+8 -3
View File
@@ -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(
@@ -51,7 +51,7 @@ if (checkCoverage) {
}
const run = cp.spawnSync(
path.resolve(__dirname, '../node_modules/.bin/mocha'),
npmBinScript('mocha'),
[...testFiles, ...flagArgs],
{
cwd: path.resolve(__dirname, '..'),
@@ -59,4 +59,9 @@ const run = cp.spawnSync(
stdio: 'inherit'
}
);
function npmBinScript(script) {
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ? `${script}.cmd` : script));
}
process.exit(run.status);