Skip to content

test_runner: make it compatible with fake timers#59272

Merged
nodejs-github-bot merged 2 commits intonodejs:mainfrom
mcollina:compatibility-with-fake-timers
Mar 22, 2026
Merged

test_runner: make it compatible with fake timers#59272
nodejs-github-bot merged 2 commits intonodejs:mainfrom
mcollina:compatibility-with-fake-timers

Conversation

@mcollina
Copy link
Copy Markdown
Member

If setTimeout is monkey-patched, it might be missing the symbol. Moreover, we plan to remove it in the future anyway in #58689.

@mcollina mcollina requested a review from rluvaton July 29, 2025 09:46
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jul 29, 2025
@rluvaton
Copy link
Copy Markdown
Member

Can you please add a test?

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.65%. Comparing base (e78bf55) to head (2779c84).
⚠️ Report is 129 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #59272   +/-   ##
=======================================
  Coverage   89.64%   89.65%           
=======================================
  Files         676      676           
  Lines      206249   206326   +77     
  Branches    39518    39529   +11     
=======================================
+ Hits       184892   184974   +82     
+ Misses      13479    13474    -5     
  Partials     7878     7878           
Files with missing lines Coverage Δ
lib/internal/test_runner/test.js 96.80% <100.00%> (ø)

... and 32 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.

@avivkeller avivkeller added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jan 3, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 3, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

mcollina added 2 commits March 3, 2026 23:06
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina force-pushed the compatibility-with-fake-timers branch from 494d33b to 2779c84 Compare March 4, 2026 14:59
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 6, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 6, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@JakobJingleheimer
Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/71595/

This has disappeared (there seems to be an on-going issue related to this).

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@avivkeller avivkeller added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 19, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Mar 19, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/59272
✔  Done loading data for nodejs/node/pull/59272
----------------------------------- PR info ------------------------------------
Title      test_runner: make it compatible with fake timers (#59272)
Author     Matteo Collina <matteo.collina@gmail.com> (@mcollina)
Branch     mcollina:compatibility-with-fake-timers -> nodejs:main
Labels     author ready, needs-ci, test_runner
Commits    2
 - test_runner: make it compatible with fake timers
 - test_runner: add test for fake timers compatibility with timeout
Committers 1
 - Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 29 Jul 2025 09:46:09 GMT
   ✔  Approvals: 5
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/59272#pullrequestreview-3068494804
   ✔  - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/59272#pullrequestreview-3069013804
   ✔  - Moshe Atlow (@MoLow): https://github.com/nodejs/node/pull/59272#pullrequestreview-3105248861
   ✔  - Aviv Keller (@avivkeller): https://github.com/nodejs/node/pull/59272#pullrequestreview-3971839550
   ✔  - Paolo Insogna (@ShogunPanda) (TSC): https://github.com/nodejs/node/pull/59272#pullrequestreview-3904476398
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-03-10T14:43:23Z: https://ci.nodejs.org/job/node-test-pull-request/71661/
- Querying data for job/node-test-pull-request/71661/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 59272
From https://github.com/nodejs/node
 * branch                  refs/pull/59272/merge -> FETCH_HEAD
✔  Fetched commits as f68824a6805a..2779c84ba2f3
--------------------------------------------------------------------------------
[main 18611378d4] test_runner: make it compatible with fake timers
 Author: Matteo Collina <hello@matteocollina.com>
 Date: Tue Jul 29 11:44:47 2025 +0200
 1 file changed, 1 insertion(+), 1 deletion(-)
[main a80d665aa6] test_runner: add test for fake timers compatibility with timeout
 Author: Matteo Collina <hello@matteocollina.com>
 Date: Wed Mar 4 15:59:18 2026 +0100
 2 files changed, 57 insertions(+)
 create mode 100644 test/fixtures/test-runner/mock-timers-with-timeout.js
 create mode 100644 test/parallel/test-runner-mock-timers-with-timeout.js
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
(node:350) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test_runner: make it compatible with fake timers

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: #59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>

[detached HEAD 59aa153f1b] test_runner: make it compatible with fake timers
Author: Matteo Collina <hello@matteocollina.com>
Date: Tue Jul 29 11:44:47 2025 +0200
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (3/4)
Rebasing (4/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test_runner: add test for fake timers compatibility with timeout

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: #59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>

[detached HEAD bde5b3bf87] test_runner: add test for fake timers compatibility with timeout
Author: Matteo Collina <hello@matteocollina.com>
Date: Wed Mar 4 15:59:18 2026 +0100
2 files changed, 57 insertions(+)
create mode 100644 test/fixtures/test-runner/mock-timers-with-timeout.js
create mode 100644 test/parallel/test-runner-mock-timers-with-timeout.js
Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/23274294427

@mcollina mcollina added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Mar 22, 2026
@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 22, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 22, 2026
@nodejs-github-bot nodejs-github-bot merged commit 8199f9c into nodejs:main Mar 22, 2026
78 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in 8199f9c

@eagle19900203-boop
Copy link
Copy Markdown

If setTimeout is monkey-patched, it might be missing the symbol. Moreover, we plan to remove it in the future anyway in #58689.

aduh95 pushed a commit that referenced this pull request Mar 25, 2026
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: #59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
VaishnavIUpadyaya pushed a commit to VaishnavIUpadyaya/node that referenced this pull request Mar 27, 2026
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: nodejs#59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
aduh95 pushed a commit that referenced this pull request Mar 28, 2026
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: #59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
aduh95 pushed a commit to Flarna/node that referenced this pull request Mar 30, 2026
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: nodejs#59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants