-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
test_runner: add cwd option to run #54705
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
Changes from 1 commit
91858b0
85e7dbb
e35b227
7d34799
18138e9
8fac041
0e9d10d
e6e8329
69acadf
b600dda
9120999
37014cc
565a938
9aea826
c9288af
71ea33d
e995bec
c6d0cec
e0b7a48
a162f2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -90,7 +90,7 @@ function createTestTree(rootTestOptions, globalOptions) { | |||||||||||||||||||||||||||||
| return globalRoot; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function createProcessEventHandler(eventName, rootTest) { | ||||||||||||||||||||||||||||||
| function createProcessEventHandler(eventName, rootTest, cwd) { | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to get the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the meantime, I've seen that in node/lib/internal/test_runner/harness.js Lines 80 to 90 in c1afd2c
While the method definition is: node/lib/internal/test_runner/harness.js Lines 182 to 184 in c1afd2c
Can I remove |
||||||||||||||||||||||||||||||
| return (err) => { | ||||||||||||||||||||||||||||||
| if (rootTest.harness.bootstrapPromise) { | ||||||||||||||||||||||||||||||
| // Something went wrong during the asynchronous portion of bootstrapping | ||||||||||||||||||||||||||||||
|
|
@@ -116,7 +116,7 @@ function createProcessEventHandler(eventName, rootTest) { | |||||||||||||||||||||||||||||
| const name = test.hookType ? `Test hook "${test.hookType}"` : `Test "${test.name}"`; | ||||||||||||||||||||||||||||||
| let locInfo = ''; | ||||||||||||||||||||||||||||||
| if (test.loc) { | ||||||||||||||||||||||||||||||
| const relPath = relative(process.cwd(), test.loc.file); | ||||||||||||||||||||||||||||||
| const relPath = relative(cwd, test.loc.file); | ||||||||||||||||||||||||||||||
| locInfo = ` at ${relPath}:${test.loc.line}:${test.loc.column}`; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -208,9 +208,9 @@ function setupProcessState(root, globalOptions) { | |||||||||||||||||||||||||||||
| hook.enable(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const exceptionHandler = | ||||||||||||||||||||||||||||||
| createProcessEventHandler('uncaughtException', root); | ||||||||||||||||||||||||||||||
| createProcessEventHandler('uncaughtException', root, globalOptions.testCwd); | ||||||||||||||||||||||||||||||
| const rejectionHandler = | ||||||||||||||||||||||||||||||
| createProcessEventHandler('unhandledRejection', root); | ||||||||||||||||||||||||||||||
| createProcessEventHandler('unhandledRejection', root, globalOptions.testCwd); | ||||||||||||||||||||||||||||||
| const coverage = configureCoverage(root, globalOptions); | ||||||||||||||||||||||||||||||
| const exitHandler = async () => { | ||||||||||||||||||||||||||||||
| if (root.subtests.length === 0 && (root.hooks.before.length > 0 || root.hooks.after.length > 0)) { | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,6 +680,9 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |
| &EnvironmentOptions::test_coverage_lines, | ||
| kAllowedInEnvvar); | ||
|
|
||
|
pmarchini marked this conversation as resolved.
|
||
| AddOption("--experimental-test-cwd", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should add this. The
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, makes sense! I was thinking about a way to set the entire test runner's Btw, while working on this, I noticed an unexpected behavior related to isolation and watch mode.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the user wants to use the CLI, they could do something like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree |
||
| "specify the working directory for the test runner", | ||
| &EnvironmentOptions::test_runner_cwd); | ||
|
pmarchini marked this conversation as resolved.
Outdated
|
||
| AddOption("--experimental-test-isolation", | ||
| "configures the type of test isolation used in the test runner", | ||
| &EnvironmentOptions::test_isolation); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.