Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Work around Node 0.10 Windows flake when testing

ScottFreeCode8710438c8de0
diff --git a/test/integration/glob.spec.js b/test/integration/glob.spec.js
index df16d282..4d1c5a52 100644
--- a/test/integration/glob.spec.js
+++ b/test/integration/glob.spec.js
@@ -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);
}