Skip to content
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

test_runner: add support for mocking setImmediate timer #49397

Conversation

ErickWendel
Copy link
Member

@ErickWendel ErickWendel commented Aug 29, 2023

This PR adds support for

  • - setImmediate
  • - timers.setImmediate
  • - timers.promises.setImmediate

This PR makes sure that setImmediate has priority higher than setTimeout and follows the spec defined in the docs about:
When multiple calls to setImmediate() are made, the callback functions are queued for execution in the order in which they are created

cc: @nodejs/test_runner

@ErickWendel ErickWendel self-assigned this Aug 29, 2023
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Aug 29, 2023

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 Aug 29, 2023
@ErickWendel ErickWendel changed the title test_runner: add support for setImmediate test_runner: add support for mocking setImmediate timer Aug 29, 2023
doc/api/test.md Outdated Show resolved Hide resolved
Co-authored-by: CW <cwunder@gnome.org>
doc/api/test.md Outdated Show resolved Hide resolved
test/parallel/test-runner-mock-timers.js Outdated Show resolved Hide resolved
test/parallel/test-runner-mock-timers.js Outdated Show resolved Hide resolved
Signed-off-by: Erick Wendel <erick.workspace@gmail.com>
Signed-off-by: Erick Wendel <erick.workspace@gmail.com>
@tniessen tniessen added the experimental Issues and PRs related to experimental features. label Aug 29, 2023
doc/api/test.md Outdated Show resolved Hide resolved
lib/internal/test_runner/mock/mock_timers.js Show resolved Hide resolved
@ErickWendel ErickWendel added request-ci Add this label to start a Jenkins CI on a PR. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 30, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2023
@nodejs-github-bot
Copy link
Collaborator

Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Moshe Atlow <moshe@atlow.co.il>
@ErickWendel ErickWendel force-pushed the test_runner/add-setImmediate-to-mock-timers branch from c1323df to 962e14a Compare August 30, 2023 17:04
@ErickWendel ErickWendel added request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 30, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@atlowChemi atlowChemi added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 31, 2023
@atlowChemi atlowChemi added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 31, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 31, 2023
@nodejs-github-bot nodejs-github-bot merged commit c750049 into nodejs:main Aug 31, 2023
33 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in c750049

UlisesGascon pushed a commit that referenced this pull request Sep 10, 2023
PR-URL: #49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@UlisesGascon UlisesGascon mentioned this pull request Sep 10, 2023
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
targos pushed a commit that referenced this pull request Nov 27, 2023
PR-URL: #49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
sercher added a commit to sercher/graaljs that referenced this pull request Apr 25, 2024
PR-URL: nodejs/node#49397
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
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. experimental Issues and PRs related to experimental features. 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