From 8710438c8de06b951b4ba99ac0e706c90fa94c91 Mon Sep 17 00:00:00 2001 From: ScottFreeCode Date: Tue, 1 Aug 2017 23:09:51 -0400 Subject: [PATCH] Work around Node 0.10 Windows flake when testing --- test/integration/glob.spec.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/integration/glob.spec.js b/test/integration/glob.spec.js index df16d28283..4d1c5a52f4 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); }