Skip to content

Commit

Permalink
Work around Node 0.10 Windows flake when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottFreeCode committed Aug 2, 2017
1 parent 26d337a commit 8710438
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/integration/glob.spec.js
Expand Up @@ -77,13 +77,22 @@ var testGlob = {
shouldFail: execMochaWith(function shouldFailWithStderr (error, stderr) { expect(error && error.message).to.contain(stderr); })
};

var isFlakeyNode = (function () {
var version = process.versions.node.split('.');
return version[0] === '0' && version[1] === '10' && process.platform === 'win32';
}());

function execMochaWith (validate) {
return function execMocha (glob, assertOn, done) {
exec(node + ' "' + path.join('..', '..', '..', '..', 'bin', 'mocha') + '" -R json-stream ' + glob, { cwd: path.join(__dirname, 'fixtures', 'glob') }, function (error, stdout, stderr) {
try {
validate(error, stderr);
assertOn({ stdout: stdout, stderr: stderr });
done();
if (isFlakeyNode && error && (stderr === '')) {
execMocha(glob, assertOn, done);
} else {
assertOn({ stdout: stdout, stderr: stderr });
done();
}
} catch (assertion) {
done(assertion);
}
Expand Down

0 comments on commit 8710438

Please sign in to comment.