Skip to content

test_runner: improve mock timer promisifiers #58824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Renegade334
Copy link
Contributor

@Renegade334 Renegade334 commented Jun 24, 2025

Add some cleanup logic to #setIntervalPromisified and #promisifyTimer to remove the abort listener when the timer either resolves or throws.

Also makes some structural simplifications to both methods. In particular, the previous implementation of #setIntervalPromisified created a single-use anonymous async iterator, before yield*ing from it; this can trivially be converted to yielding from a for await loop.

Needs dont-land-on-v20.x for Promise.withResolvers.

@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 Jun 24, 2025
* yield from loop instead of setting up custom iterator
* cancel abort listener on exit
* do not call <Array>.at(0)
@Renegade334 Renegade334 force-pushed the mock-timers-improve-promisifiers branch from 8514444 to d28af81 Compare June 24, 2025 23:09
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

Attention: Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.08%. Comparing base (6ce6fdb) to head (d28af81).
Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/mock/mock_timers.js 97.67% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58824      +/-   ##
==========================================
- Coverage   90.10%   90.08%   -0.02%     
==========================================
  Files         640      640              
  Lines      188384   188350      -34     
  Branches    36937    36935       -2     
==========================================
- Hits       169743   169677      -66     
- Misses      11363    11395      +32     
  Partials     7278     7278              
Files with missing lines Coverage Δ
lib/internal/test_runner/mock/mock_timers.js 98.68% <97.67%> (-0.06%) ⬇️

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

@atlowChemi atlowChemi added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 29, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 29, 2025
@nodejs-github-bot

This comment was marked as outdated.

@Renegade334
Copy link
Contributor Author

Could this please get commit-queue-squash and dont-land-on-v20.x?

@nodejs-github-bot
Copy link
Collaborator

@JakobJingleheimer JakobJingleheimer added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. labels Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. 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.

5 participants