Skip to content

test_runner: make it compatible with fake timers#59272

Open
mcollina wants to merge 2 commits intonodejs:mainfrom
mcollina:compatibility-with-fake-timers
Open

test_runner: make it compatible with fake timers#59272
mcollina wants to merge 2 commits intonodejs:mainfrom
mcollina:compatibility-with-fake-timers

Conversation

@mcollina
Copy link
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
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
Member

Can you please add a test?

@codecov
Copy link

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 119 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
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
Collaborator

@JakobJingleheimer
Copy link
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
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
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

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-failed An error occurred while landing this pull request using GitHub Actions. 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.

9 participants