Skip to content

test: deflake test-worker-eventlooputil - #67260

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:deflake-worker-eventlooputil
Open

mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:deflake-worker-eventlooputil

Conversation

@mcollina

@mcollina mcollina commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

worker.performance.eventLoopUtilization() reads the worker's idle time
before the current time. If the parent thread stalls between the two
reads while the worker is idle, the stall is counted as worker active
time in the first sample and is missing from the delta, so the 50ms
spin can be reported as slightly less than 50ms:

AssertionError [ERR_ASSERTION]: 48.961083001159786 < 50
    at MessagePort.<anonymous> (test/sequential/test-worker-eventlooputil.js:104:12)

Injecting a 2ms busy-wait between the two reads reproduces it every time
(active=48.05). The test now bounds the skew by timing the first
workerELU() call.

Refs: nodejs/reliability#1482


AI Generated, reviewed by me

worker.performance.eventLoopUtilization() reads the worker's idle time
before the current time. If the parent thread stalls between the two
reads while the worker is idle, the stall is counted as worker active
time in the first sample and is missing from the delta, so the 50ms
spin can be reported as slightly less than 50ms.

Bound that skew by timing the first workerELU() call.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (98dbf60) to head (7013ebf).
⚠️ Report is 112 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67260      +/-   ##
==========================================
+ Coverage   90.65%   90.66%   +0.01%     
==========================================
  Files         797      797              
  Lines      278268   279367    +1099     
  Branches    53517    53735     +218     
==========================================
+ Hits       252261   253291    +1030     
+ Misses      16386    16360      -26     
- Partials     9621     9716      +95     

see 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants