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: add runner watch mode isolation tests #54888

Merged

Conversation

pmarchini
Copy link
Member

This PR extends the existing tests for the Node.js test runner's --watch mode by adding support for the --experimental-test-isolation option.

@cjihrig I was unable to find a test that covers this combination.
I also noticed that the should run new tests when a new file is created in the watched directory test behaves differently depending on the isolation modes.
What do you think?

@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 Issues and PRs related to the tests. labels Sep 11, 2024
@cjihrig
Copy link
Contributor

cjihrig commented Sep 11, 2024

What do you think?

Without having investigated the discrepancy, I'd say they should behave the same.

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.06%. Comparing base (6db320a) to head (0eab852).
Report is 526 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54888      +/-   ##
==========================================
- Coverage   88.07%   88.06%   -0.01%     
==========================================
  Files         651      651              
  Lines      183538   183538              
  Branches    35861    35864       +3     
==========================================
- Hits       161652   161635      -17     
+ Misses      15145    15140       -5     
- Partials     6741     6763      +22     

see 34 files with indirect coverage changes

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. Two small comments. Have you been able to identify why the one test fails without isolation?

await testWatch({ fileToUpdate: 'test.js', action: 'rename', isolation });
});

it('should not throw when delete a watched test file', { skip: common.isAIX }, async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We already skip the entire file at the very top when running on AIX.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

await testWatch({ fileToUpdate: 'test.js', action: 'delete', isolation });
});

if (isolation !== 'none') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of an if statement, we could make it a TODO or SKIP test. TODO will run but a failure will not fail the test suite. SKIP won't run at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

I left the comment because I was planning to fix the issue in this PR, but I haven't had the time in the last two days. I'm going to address your comments, and then I'll investigate the issue ASAP.
(Thanks, as always, for the feedback 😁)

Copy link
Member Author

Choose a reason for hiding this comment

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

updated! 🚀

@pmarchini
Copy link
Member Author

Mostly LGTM. Two small comments. Have you been able to identify why the one test fails without isolation?

Hey @cjihrig, I just had the chance to take a look, and every time that a file changes (rename, delete, update), if we are in isolation none, then restartTestFile restarts all the tests without filtering based on the "added, updated, removed" logic.

I'll try to address this issue in a separate PR if you agree.

@cjihrig
Copy link
Contributor

cjihrig commented Sep 14, 2024

That makes sense. Thanks for digging in. I'd say if you want to try working on it and think you can improve the experience then go for it! If not, it's still good to have these tests 😄

@cjihrig cjihrig added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 14, 2024
@pmarchini
Copy link
Member Author

That makes sense. Thanks for digging in. I'd say if you want to try working on it and think you can improve the experience then go for it! If not, it's still good to have these tests 😄

I'll definitely give it a try 😁

@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

@pmarchini pmarchini force-pushed the test/test-runner-watch-mode-isolation branch from 63a09ed to 0eab852 Compare September 15, 2024 08:49
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 15, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Sep 17, 2024

@cjihrig cjihrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed needs-ci PRs that need a full CI run. labels Sep 17, 2024
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

@mcollina mcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 20, 2024
@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 Sep 20, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/54888
✔  Done loading data for nodejs/node/pull/54888
----------------------------------- PR info ------------------------------------
Title      test: add runner watch mode isolation tests (#54888)
Author     Pietro Marchini <pietro.marchini94@gmail.com> (@pmarchini)
Branch     pmarchini:test/test-runner-watch-mode-isolation -> nodejs:main
Labels     test, author ready
Commits    3
 - test: add runner watch mode isolation tests
 - test: remove unused skip
 - test: add todo test
Committers 1
 - Pietro Marchini <pietro.marchini94@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 11 Sep 2024 14:40:20 GMT
   ✔  Approvals: 2
   ✔  - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/54888#pullrequestreview-2308136143
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/54888#pullrequestreview-2318229689
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-09-17T00:43:41Z: https://ci.nodejs.org/job/node-test-pull-request/62489/
- Querying data for job/node-test-pull-request/62489/
   ✔  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
   99433a2d7a..f79fd03f41  main       -> origin/main
✔  origin/main is now up-to-date
main is out of sync with origin/main. Mismatched commits:
 - e84fdebd7b test_runner: add support for coverage via run()
 - f79fd03f41 test_runner: add support for coverage via run()
--------------------------------------------------------------------------------
HEAD is now at f79fd03f41 test_runner: add support for coverage via run()
   ✔  Reset to origin/main
- Downloading patch for 54888
From https://github.com/nodejs/node
 * branch                  refs/pull/54888/merge -> FETCH_HEAD
✔  Fetched commits as f79fd03f4161..0eab8529cfdc
--------------------------------------------------------------------------------
[main 2096064b13] test: add runner watch mode isolation tests
 Author: Pietro Marchini <pietro.marchini94@gmail.com>
 Date: Sun Sep 15 10:46:24 2024 +0200
 1 file changed, 27 insertions(+), 18 deletions(-)
[main 69a35d3c4d] test: remove unused skip
 Author: Pietro Marchini <pietro.marchini94@gmail.com>
 Date: Sun Sep 15 10:46:36 2024 +0200
 1 file changed, 3 insertions(+), 3 deletions(-)
[main 82759fbd55] test: add todo test
 Author: Pietro Marchini <pietro.marchini94@gmail.com>
 Date: Sun Sep 15 10:46:36 2024 +0200
 1 file changed, 7 insertions(+), 6 deletions(-)
   ✔  Patches applied
There are 3 commits in the PR. Attempting autorebase.
Rebasing (2/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: add runner watch mode isolation tests

PR-URL: #54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

[detached HEAD ea69604a6f] test: add runner watch mode isolation tests
Author: Pietro Marchini <pietro.marchini94@gmail.com>
Date: Sun Sep 15 10:46:24 2024 +0200
1 file changed, 27 insertions(+), 18 deletions(-)
Rebasing (3/6)
Rebasing (4/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: remove unused skip

PR-URL: #54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

[detached HEAD 5dc478195c] test: remove unused skip
Author: Pietro Marchini <pietro.marchini94@gmail.com>
Date: Sun Sep 15 10:46:36 2024 +0200
1 file changed, 3 insertions(+), 3 deletions(-)
Rebasing (5/6)
Rebasing (6/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: add todo test

PR-URL: #54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>

[detached HEAD 72ccb24833] test: add todo test
Author: Pietro Marchini <pietro.marchini94@gmail.com>
Date: Sun Sep 15 10:46:36 2024 +0200
1 file changed, 7 insertions(+), 6 deletions(-)

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/10960018630

@avivkeller avivkeller removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 20, 2024
@avivkeller avivkeller added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 20, 2024
@avivkeller
Copy link
Member

(Ignore my last [deleted] comment) I've added commit-queue-squash to this PR, it should be good to commit now.

@cjihrig cjihrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 20, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 20, 2024
@nodejs-github-bot nodejs-github-bot merged commit e35299a into nodejs:main Sep 20, 2024
74 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in e35299a

targos pushed a commit that referenced this pull request Oct 4, 2024
PR-URL: #54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@aduh95 aduh95 mentioned this pull request Oct 9, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@marco-ippolito marco-ippolito added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Nov 16, 2024
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
PR-URL: nodejs#54888
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.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. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants