Skip to content

armgit / mocha

Public Imported from GitHub
0

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

avoid test flake in "delay" test; closes #2469 (#2470)

Christopher Hiller539255c8a8c8
diff --git a/test/integration/fixtures/options/delay.js b/test/integration/fixtures/options/delay.js
index 32b8f993..a8bf2d41 100644
--- a/test/integration/fixtures/options/delay.js
+++ b/test/integration/fixtures/options/delay.js
@@ -1,13 +1,8 @@
var assert = require('assert');
var delay = 500;
-var start = new Date().getTime();
setTimeout(function() {
describe('delayed execution', function() {
- it('should have waited ' + delay + 'ms to run this suite', function() {
- assert(new Date().getTime() - delay >= start);
- });
-
it('should have no effect if attempted twice in the same suite', function() {
assert(true);
run();
diff --git a/test/integration/options.js b/test/integration/options.js
index 5e18ac5e..5371b7a7 100644
--- a/test/integration/options.js
+++ b/test/integration/options.js
@@ -85,11 +85,11 @@ describe('options', function() {
run('options/delay.js', args, function(err, res) {
assert(!err);
assert.equal(res.stats.pending, 0);
- assert.equal(res.stats.passes, 2);
+ assert.equal(res.stats.passes, 1);
assert.equal(res.stats.failures, 0);
assert.equal(res.passes[0].title,
- 'should have waited 500ms to run this suite');
+ 'should have no effect if attempted twice in the same suite');
assert.equal(res.code, 0);
done();
});