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: refactor primordial-based Promise chains #55958

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

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Nov 22, 2024

This PR refactors two Promise chains in the test runner to use async/await style syntax instead. IMO this makes these two pieces of code significantly more readable (largely because of primordials), and will make some planned changes easier to implement.

test_runner: refactor build Promise in Suite()

This commit refactors the buildSuite Promise logic in the Suite
constructor to use an async function instead of creating an
awkward primordial-based Promise chain.

test_runner: refactor Promise chain in run()

This commit refactors the chain of functions in run() to use an
async function instead of creating an awkward primordial-based
Promise chain.

@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 Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (e92499c) to head (5f2f366).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #55958   +/-   ##
=======================================
  Coverage   87.99%   88.00%           
=======================================
  Files         653      653           
  Lines      188091   188090    -1     
  Branches    35941    35943    +2     
=======================================
+ Hits       165516   165523    +7     
+ Misses      15751    15734   -17     
- Partials     6824     6833    +9     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 89.02% <100.00%> (+0.09%) ⬆️
lib/internal/test_runner/test.js 96.95% <100.00%> (-0.02%) ⬇️

... and 36 files with indirect coverage changes

---- 🚨 Try these New Features:

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This commit refactors the buildSuite Promise logic in the Suite
constructor to use an async function instead of creating an
awkward primordial-based Promise chain.
This commit refactors the chain of functions in run() to use an
async function instead of creating an awkward primordial-based
Promise chain.
@cjihrig cjihrig added commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 24, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 24, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@cjihrig cjihrig added commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Nov 25, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 25, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/55958
✔  Done loading data for nodejs/node/pull/55958
----------------------------------- PR info ------------------------------------
Title      test_runner: refactor primordial-based Promise chains (#55958)
Author     Colin Ihrig <[email protected]> (@cjihrig)
Branch     cjihrig:promises -> nodejs:main
Labels     commit-queue-rebase, test_runner
Commits    2
 - test_runner: refactor build Promise in Suite()
 - test_runner: refactor Promise chain in run()
Committers 1
 - cjihrig <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/55958
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Pietro Marchini <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/55958
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Pietro Marchini <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last approving review:
   ⚠  - test_runner: refactor build Promise in Suite()
   ⚠  - test_runner: refactor Promise chain in run()
   ℹ  This PR was created on Fri, 22 Nov 2024 21:02:13 GMT
   ✔  Approvals: 7
   ✔  - Yagiz Nizipli (@anonrig) (TSC): https://github.com/nodejs/node/pull/55958#pullrequestreview-2455645777
   ✔  - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456378535
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456381657
   ✔  - Pietro Marchini (@pmarchini): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456382466
   ✔  - Jacob Smith (@JakobJingleheimer): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456411715
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456425980
   ✔  - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/55958#pullrequestreview-2456475030
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-11-25T00:15:13Z: https://ci.nodejs.org/job/node-test-pull-request/63691/
- Querying data for job/node-test-pull-request/63691/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/12002350325

@nodejs-github-bot nodejs-github-bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-failed An error occurred while landing this pull request using GitHub Actions. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. 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