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 'test:summary' event #54851

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

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Sep 8, 2024

This commit adds a new 'test:summary' event to the test runner's reporting interface. This new event serves two purposes:

  • In the future, the test runner internals will no longer need to change the process exit code. This may be important to run() users. Unfortunately, this is a breaking change, so it needs to be changed in a major version.
  • The reporting interface now has a single event that can identify passing or failing test runs.

Refs: #53867
Refs: #54812

(Still need to add docs)

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Sep 8, 2024
@RedYetiDev RedYetiDev added test_runner Issues and PRs related to the test runner subsystem. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels Sep 8, 2024
Copy link

codecov bot commented Sep 8, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.02%. Comparing base (e35299a) to head (81e000d).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/harness.js 72.72% 3 Missing ⚠️
lib/internal/test_runner/test.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54851      +/-   ##
==========================================
- Coverage   88.03%   88.02%   -0.01%     
==========================================
  Files         652      652              
  Lines      183797   183822      +25     
  Branches    35863    35868       +5     
==========================================
+ Hits       161804   161813       +9     
- Misses      15242    15259      +17     
+ Partials     6751     6750       -1     
Files with missing lines Coverage Δ
lib/internal/main/test_runner.js 100.00% <100.00%> (ø)
lib/internal/test_runner/tests_stream.js 91.61% <100.00%> (+0.53%) ⬆️
lib/internal/test_runner/utils.js 55.88% <100.00%> (+0.14%) ⬆️
lib/internal/test_runner/test.js 96.93% <87.50%> (-0.07%) ⬇️
lib/internal/test_runner/harness.js 92.65% <72.72%> (-0.72%) ⬇️

... and 22 files with indirect coverage changes

@RedYetiDev RedYetiDev added the wip Issues and PRs that are still a work in progress. label Sep 14, 2024
@RedYetiDev
Copy link
Member

(Still need to add docs)

I've added the wip label, as you stated that you still need to add the documentation for this PR

@cjihrig cjihrig removed the wip Issues and PRs that are still a work in progress. label Sep 14, 2024
@cjihrig cjihrig requested a review from MoLow September 14, 2024 19:18
@atlowChemi atlowChemi added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 14, 2024
@atlowChemi
Copy link
Member

Unfortunately, this is a breaking change, so it needs to be changed in a major version.

Added semver-major PRs that contain breaking changes and should be released in the next major version.

@cjihrig
Copy link
Contributor Author

cjihrig commented Sep 14, 2024

Unfortunately, this is a breaking change, so it needs to be changed in a major version.

The original implementation that changed the process exit code was semver major. I removed that change, so this is only semver minor now

@atlowChemi atlowChemi removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 14, 2024
@RedYetiDev RedYetiDev added the semver-minor PRs that contain new features and should be released in the next minor version. label Sep 14, 2024
@cjihrig cjihrig added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 14, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 14, 2024
@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

Can we make it non-breaking by detecting if there is a summary listener and if not reverting to the old behavior? I think having this as a major would significantly impact the ability to backport certain fixes to v20 and v22.

@cjihrig
Copy link
Contributor Author

cjihrig commented Sep 15, 2024

Can we make it non-breaking by detecting if there is a summary listener and if not reverting to the old behavior?

This change is no longer breaking. Do you mean the setting of the exit code? Yes, we could do that - I think I'd prefer to do that in a separate PR though.

@mcollina
Copy link
Member

For whatever reason I didn't see the last couple of messages, nevermind!

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

@RedYetiDev RedYetiDev added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 18, 2024
This commit adds a new 'test:summary' event to the test runner's
reporting interface. This new event serves two purposes:

- In the future, the test runner internals will no longer need to
  change the process exit code. This may be important to run()
  users. Unfortunately, this is a breaking change, so it needs to
  be changed in a major version.
- The reporting interface now has a single event that can identify
  passing or failing test runs.

Refs: nodejs#53867
Refs: nodejs#54812
@cjihrig cjihrig added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Sep 20, 2024
@nodejs-github-bot
Copy link
Collaborator

@cjihrig
Copy link
Contributor Author

cjihrig commented Sep 20, 2024

Rebased to pick up the latest changes and renamed all to tests.

@RedYetiDev
Copy link
Member

RedYetiDev commented Sep 20, 2024

Can you remove the logic for #53937's handling of the exit code for thresholds, as it's no longer needed with this, right?

Notably the documentation about exit codes here, here, and here.

@cjihrig
Copy link
Contributor Author

cjihrig commented Sep 20, 2024

No. run() will continue to set the process exit code even though it's not needed with this event. Changing run() to not change the exit code is a breaking change that we shouldn't make until all supported release lines have access to this event.

@cjihrig
Copy link
Contributor Author

cjihrig commented Sep 20, 2024

This needs a re-approval in order to land. The CI is good.

@cjihrig cjihrig removed the needs-ci PRs that need a full CI run. label Sep 20, 2024
@RedYetiDev
Copy link
Member

RedYetiDev commented Sep 20, 2024

No. run() will continue to set the process exit code even though it's not needed with this event. Changing run() to not change the exit code is a breaking change that we shouldn't make until all supported release lines have access to this event.

Oh okay, I thought that that didn't happen with this change. My bad. I'll probably open a followup (breaking?) PR to change that after this.

@RedYetiDev RedYetiDev added the review wanted PRs that need reviews. label Sep 20, 2024
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. review wanted PRs that need reviews. semver-minor PRs that contain new features and should be released in the next minor version. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants