Skip to content

test_runner: support watch mode - #45214

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
MoLow:test_runner_watch_mode
Nov 13, 2022
Merged

nodejs-github-bot merged 2 commits into
nodejs:mainfrom
MoLow:test_runner_watch_mode

Conversation

@MoLow

@MoLow MoLow commented Oct 27, 2022 •

Copy link
Copy Markdown
Member

TODO:

  • tests
  • documentation?
  • call clearFileFilters for specific child process
  • if it doesn't take too long - wait for TAP parser to land to avoid conflicts

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 27, 2022
@MoLow MoLow added test_runner Issues and PRs related to the test runner subsystem. watch-mode Issues and PRs related to watch mode. labels Oct 27, 2022
Comment thread lib/internal/test_runner/runner.js Resolved
@MoLow
MoLow force-pushed the test_runner_watch_mode branch from 91df6e5 to 49ad862 Compare November 6, 2022 21:41
@cjihrig

cjihrig commented Nov 9, 2022

Copy link
Copy Markdown
Contributor

@MoLow is this ready for review? At a minimum, it looks like there are linter issues.

@MoLow

MoLow commented Nov 9, 2022

Copy link
Copy Markdown
Member Author

is this ready for review? At a minimum, it looks like there are linter issues.

not yet, will work on it today/tomorrow

@MoLow
MoLow force-pushed the test_runner_watch_mode branch from 49ad862 to 9be722d Compare November 10, 2022 18:01
@MoLow

MoLow commented Nov 10, 2022

Copy link
Copy Markdown
Member Author

@nodejs/test_runner ready for review

Comment thread lib/internal/test_runner/runner.js Resolved

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably update the doc of --watch-path and --test to clarify they can't be used together

node/doc/api/cli.md

Lines 1214 to 1216 in f1e9382

Starts the Node.js command line test runner. This flag cannot be combined with
`--check`, `--eval`, `--interactive`, or the inspector. See the documentation
on [running tests from the command line][] for more details.

node/doc/api/cli.md

Lines 1610 to 1611 in f1e9382

This flag cannot be combined with
`--check`, `--eval`, `--interactive`, or the REPL.

We could add an entry to the history of --watch and --test to say that now they can be used together.

Could we add a test to ensure watching ESM works? And maybe even ESM+CJS?

Comment thread src/node_options.cc Resolved
Comment thread lib/internal/test_runner/runner.js Resolved
Comment thread doc/api/test.md Resolved
Comment thread test/fixtures/test-runner/dependency.js Resolved
Comment thread doc/api/cli.md Resolved
Comment thread lib/internal/test_runner/runner.js Resolved
@MoLow

MoLow commented Nov 11, 2022

Copy link
Copy Markdown
Member Author

@ErickWendel you were asking about this

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if you missed it in my previous review, I was asking if it would be possible to add tests for ESM (i.e. does dependencies loaded though import() from a CJS files are picked up)

Comment thread lib/internal/test_runner/runner.js Resolved
Comment thread doc/api/test.md Resolved
Comment thread lib/internal/test_runner/runner.js Resolved
@MoLow MoLow added the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Nov 12, 2022
Comment thread lib/internal/test_runner/runner.js Resolved
Comment thread test/fixtures/test-runner/dependent.js Resolved
@MoLow

MoLow commented Nov 13, 2022

Copy link
Copy Markdown
Member Author

Going to rebase on top of #45348 to avoid conflicts

@MoLow
MoLow force-pushed the test_runner_watch_mode branch from bf37536 to 28f8da3 Compare November 13, 2022 15:21
@MoLow MoLow removed the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Nov 13, 2022
@MoLow
MoLow requested a review from cjihrig November 13, 2022 15:23
@MoLow MoLow added the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Nov 13, 2022
@MoLow MoLow added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 13, 2022
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 13, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MoLow MoLow added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 13, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 13, 2022
@nodejs-github-bot
nodejs-github-bot merged commit 97355c7 into nodejs:main Nov 13, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 97355c7

@MoLow
MoLow deleted the test_runner_watch_mode branch November 13, 2022 21:41
ruyadorno pushed a commit that referenced this pull request Nov 21, 2022
PR-URL: #45214
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@ruyadorno ruyadorno mentioned this pull request Nov 24, 2022
MoLow added a commit to MoLow/node that referenced this pull request Dec 9, 2022
PR-URL: nodejs#45214
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
PR-URL: #45214
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
PR-URL: #45214
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@MoLow MoLow mentioned this pull request Apr 23, 2023
nodejs-github-bot pushed a commit that referenced this pull request Nov 6, 2026
filterFile() reads #ownerDependencies with the dependency path, but
writes the set back keyed by the owner, so each call starts a fresh set
and overwrites the previous one. An owner keeps only the last
dependency registered for it.

unfilterFilesOwnedBy() walks that set to release an owner's
dependencies, so every other one stays in #filteredFiles and
#dependencyOwners. Under `node --test --watch` a restart re-reports the
modules the test still loads, which hides it for those, but a
dependency it stopped requiring is never reported again and keeps
re-running the test.

Read #ownerDependencies with the key it is written with, and collapse
the repeated #dependencyOwners lookup in the loop, which now runs once
per dependency rather than once per owner.

Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: #66139
Refs: #45214
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash PRs the Commit Queue should land as one squashed commit. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. watch-mode Issues and PRs related to watch mode.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants