Skip to content

Commit ec65984

Browse files
TrottMylesBorins
authored andcommitted
test: move timer-dependent test to sequential
`test-regress-GH-897` is dependent on a timer firing within a period of time. Especially on some of the FreeBSD hosts on CI, we have seen tests like that fail when run in parallel. (This may have nothing to do with FreeBSD and may just mean that the hosts are resource-constrained.) Move this test to sequential as we have done with several other timer-dependent tests recently. The test has also been refactored and documented via comments. PR-URL: #9487 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent e2791de commit ec65984

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

test/parallel/test-regress-GH-897.js

-15
This file was deleted.
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
// Test for bug where a timer duration greater than 0 ms but less than 1 ms
4+
// resulted in the duration being set for 1000 ms. The expected behavior is
5+
// that the timeout would be set for 1 ms, and thus fire more-or-less
6+
// immediately.
7+
//
8+
// Ref: https://github.com/nodejs/node-v0.x-archive/pull/897
9+
10+
const common = require('../common');
11+
const assert = require('assert');
12+
13+
const t = Date.now();
14+
setTimeout(common.mustCall(function() {
15+
const diff = Date.now() - t;
16+
assert.ok(diff < 100, `timer fired after ${diff} ms`);
17+
}), 0.1);

0 commit comments

Comments
 (0)