Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7920402

Browse filesBrowse files
smitleyRafaelGSS
authored andcommitted
test: fix test-performance-measure
Refs: #42949 Looking at the documentation for setTimeout (https://nodejs.org/api/timers.html#settimeoutcallback-delay-args) there is no guarantee that setTimeout won't complete early. From the failure of #42949 this is likely what happened. I have updated the assert.ok test to allow some variation in the test. PR-URL: #44637 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent d9cdc39 commit 7920402
Copy full SHA for 7920402

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-performance-measure.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-performance-measure.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ const assert = require('assert');
55

66
const { PerformanceObserver, performance } = require('perf_hooks');
77
const DELAY = 1000;
8+
const ALLOWED_MARGIN = 10;
89

910
const expected = ['Start to Now', 'A to Now', 'A to B'];
1011
const obs = new PerformanceObserver(common.mustCall((items) => {
1112
items.getEntries().forEach(({ name, duration }) => {
12-
assert.ok(duration > DELAY);
13+
assert.ok(duration > (DELAY - ALLOWED_MARGIN));
1314
assert.strictEqual(expected.shift(), name);
1415
});
1516
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.