FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test_runner: add initial CLI runner by cjihrig · Pull Request #42658 · nodejs/node · GitHub

/ node Public

test_runner: add initial CLI runner - #42658

Merged
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
cjihrig:test-cli
Apr 15, 2022
Merged

test_runner: add initial CLI runner#42658
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
cjihrig:test-cli

Conversation

cjihrig commented Apr 8, 2022

Copy link
Copy Markdown
Contributor

This commit introduces an initial version of a CLI-based test runner.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

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 Apr 8, 2022
Comment thread doc/api/test.md Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread doc/api/test.md Outdated
Comment thread doc/api/test.md Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/test_runner/tap_stream.js Outdated

aduh95 commented Apr 8, 2022

Copy link
Copy Markdown
Contributor

//cc @nodejs/test_runner

richardlau added the semver-minor PRs that contain new features and should be released in the next minor version. label Apr 8, 2022

ljharb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How does --test affect --require, or loaders? What happens to the REPL with node --test and no other arguments?

If NODE_OPTIONS='--test' is set, and the user doesn't control how node is invoked (via a shebang, for example), does this mean the user can never "undo" test mode?

This really feels to me like it should be an entirely distinct binary, rather than just a "mode" of the main node binary.

Comment thread doc/api/test.md Outdated
Comment thread doc/api/test.md Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/main/test_runner.js Outdated
Comment thread lib/internal/test_runner/utils.js Outdated
Comment thread lib/internal/test_runner/tap_stream.js Outdated
Comment thread lib/internal/main/test_runner.js Outdated

Copy link
Copy Markdown
Member

If NODE_OPTIONS='--test' is set, and the user doesn't control how node is invoked (via a shebang, for example), does this mean the user can never "undo" test mode?

As this PR currently is --test hasn't been added to the allow list for NODE_OPTIONS so setting it there would throw an error.

ljharb commented Apr 8, 2022

Copy link
Copy Markdown
Member

@richardlau thanks, if that's explicitly going to never be allowed there then that does mitigate that one concern, but all the others remain.

cjihrig commented Apr 8, 2022

Copy link
Copy Markdown
Contributor Author

How does --test affect --require, or loaders? What happens to the REPL with node --test and no other arguments?

node --test doesn't launch the REPL. I haven't tried a loader, but --require seems to work fine.

If NODE_OPTIONS='--test' is set, and the user doesn't control how node is invoked (via a shebang, for example), does this mean the user can never "undo" test mode?

--test in NODE_OPTIONS explicitly errors out.

Comment thread doc/api/test.md Outdated
Comment thread doc/api/test.md Outdated
cjihrig force-pushed the test-cli branch 2 times, most recently from f3263c3 to 805361e Compare April 9, 2022 18:32
Comment thread doc/api/test.md Outdated
Comment thread doc/api/test.md Outdated
Comment thread doc/api/test.md Outdated
Comment thread lib/internal/test_runner/utils.js Outdated
Comment thread doc/api/cli.md Outdated
cjihrig force-pushed the test-cli branch 2 times, most recently from be14d2f to a8c868e Compare April 10, 2022 23:00
Comment thread doc/api/test.md Outdated
Comment thread src/node_options.cc Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just a question: why is this? I can definitely see wanting to run the inspector for debugging while running tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A couple reasons:

  1. First, it's trivial to run an individual file with the inspector flags. At this point, the CLI runner is just spawning Node child processes with no special flags.
  2. Debugging through the CLI test runner is an awkward experience similar to the cluster module. Each test file will need a different debugger port. We would need to manage that logic as well as relay the correct information to users (I want to debug test X, I need to debug file Y, and connect to debug port Z). It also doesn't make sense to set something like --inspect-brk on a bunch of child processes.
  3. I looked at a couple test frameworks, and they didn't seem to have a great story around propagating inspector flags to test files.
  4. If someone is passionate about this, it can be added in the future. It just didn't seem worth it to me for an initial version given the previous points. I think it would make sense in the future to have configuration options for execArgv and argv of the child processes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we use chrome's debugger blackboxing stuff to "hide" the test runner code when inspecting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Possibly - I'm not sure though.

nodejs-github-bot merged commit adaf602 into nodejs:master Apr 15, 2022

Copy link
Copy Markdown
Collaborator

Landed in adaf602

cjihrig deleted the test-cli branch April 15, 2022 17:50
xtx1130 pushed a commit to xtx1130/node that referenced this pull request Apr 25, 2022
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: nodejs#42658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2022
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: #42658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
targos added a commit that referenced this pull request May 2, 2022
Notable changes:

doc:
  * add @kuriyosh to collaborators (Yoshiki Kurihara) #42824
lib,src:
  * (SEMVER-MINOR) implement WebAssembly Web API (Tobias Nießen) #42701
test_runner:
  * (SEMVER-MINOR) add initial CLI runner (Colin Ihrig) #42658
worker:
  * (SEMVER-MINOR) add hasRef() to MessagePort (Darshan Sen) #42849

PR-URL: #42943
targos mentioned this pull request May 2, 2022
targos added a commit that referenced this pull request May 3, 2022
Notable changes:

doc:
  * add @kuriyosh to collaborators (Yoshiki Kurihara) #42824
lib,src:
  * (SEMVER-MINOR) implement WebAssembly Web API (Tobias Nießen) #42701
test_runner:
  * (SEMVER-MINOR) add initial CLI runner (Colin Ihrig) #42658
worker:
  * (SEMVER-MINOR) add hasRef() to MessagePort (Darshan Sen) #42849

PR-URL: #42943

sosoba commented May 4, 2022

Copy link
Copy Markdown
Contributor

Who will extend the @types/node package with a new node:test module?

Trott commented May 4, 2022

Copy link
Copy Markdown
Member

Who will extend the @types/node package with a new node:test module?

As always, the maintainers of https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node.

tniessen added the test_runner Issues and PRs related to the test runner subsystem. label Jun 8, 2022
targos pushed a commit to aduh95/node that referenced this pull request Jul 31, 2022
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: nodejs#42658
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: #42658
Backport-PR-URL: #43904
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
This commit introduces an initial version of a CLI-based
test runner.

PR-URL: nodejs/node#42658
Backport-PR-URL: nodejs/node#43904
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. 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.


Back | FazBrowse Home | New Git URL