Skip to content

Conversation

@mcollina
Copy link
Member

@mcollina mcollina commented Feb 1, 2026

Summary

  • Fixes flaky test test/sequential/test-performance-eventloopdelay.js
  • The test was failing intermittently on IBM sharedlibs containers

Problem

The test was flaky because the histogram sampling might not have completed
before the assertions ran. The assertion assert(histogram.min > 0) could
fail if no samples were recorded yet.

Solution

  • Wrapped the assertions in setImmediate(common.mustCall(() => {...})) to
    give the event loop a chance to record final samples before checking
  • Added an explicit check for histogram.count > 0 to provide a clearer
    error message if no samples are recorded

Verification

Verified with python3 tools/test.py --repeat 50 without failures.

Refs: nodejs/reliability#1450

The test was flaky because the histogram sampling might not have
completed before the assertions ran. By using setImmediate before
disabling the histogram and checking values, we give the event loop
a chance to record final samples on slower systems.

Also added an explicit check for histogram.count > 0 to provide a
clearer error message if no samples are recorded.

Refs: nodejs/reliability#1450
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Feb 1, 2026
@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.67%. Comparing base (27a7bbc) to head (25ea05c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61629      +/-   ##
==========================================
- Coverage   89.76%   89.67%   -0.09%     
==========================================
  Files         673      673              
  Lines      203945   203926      -19     
  Branches    39191    39136      -55     
==========================================
- Hits       183076   182877     -199     
- Misses      13198    13345     +147     
- Partials     7671     7704      +33     

see 40 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 the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants