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

test_runner: skip `--require` for test orchestration process by MoLow · Pull Request #52099 · nodejs/node · GitHub

/ node Public

test_runner: skip --require for test orchestration process - #52099

Closed
MoLow wants to merge 3 commits into
nodejs:mainfrom
MoLow:test-runner-require
Closed

test_runner: skip --require for test orchestration process#52099
MoLow wants to merge 3 commits into
nodejs:mainfrom
MoLow:test-runner-require

Conversation

MoLow commented Mar 15, 2024

Copy link
Copy Markdown
Member

Fixes #48467

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

nodejs-github-bot added needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. labels Mar 15, 2024

MoLow commented Mar 15, 2024

Copy link
Copy Markdown
Member Author

Watch mode already has such tests in place and dosen't need this condition since it passes initializeModules=false to https://github.com/nodejs/node/blob/7002b3a1962e3061c70ac20d2a3ed305557e2023/lib/internal/process/pre_execution.js#L53
test runner must pass initializeModules=true for reporters to work

it('should load --require modules in the watched process, and not in the orchestrator process', async () => {
const file = createTmpFile();
const required = createTmpFile('process._rawDebug(\'pid\', process.pid);');
const args = ['--require', required, file];
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
const importPid = parseInt(stdout[0].split(' ')[1], 10);
assert.notStrictEqual(pid, importPid);
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
]);
});
it('should load --import modules in the watched process, and not in the orchestrator process', async () => {
const file = createTmpFile();
const imported = "data:text/javascript,process._rawDebug('pid', process.pid);";
const args = ['--import', imported, file];
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
const importPid = parseInt(stdout[0].split(' ')[1], 10);
assert.notStrictEqual(pid, importPid);
assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
`Restarting ${inspect(file)}`,
'running',
`Completed running ${inspect(file)}`,
]);
});

MoLow force-pushed the test-runner-require branch 2 times, most recently from 0fc431e to ee77010 Compare March 15, 2024 13:40
Comment thread lib/internal/process/pre_execution.js Outdated
Comment thread test/parallel/test-runner-cli.js Outdated
Comment thread test/parallel/test-runner-cli.js Outdated
Comment thread lib/internal/process/pre_execution.js Outdated

Copy link
Copy Markdown
Member

Wouldn't it break the following

node --require ts-node/register --test-reporter=ts-reporter.ts --test test.js

Not near computer so can't verify at the moment

MoLow commented Mar 17, 2024

Copy link
Copy Markdown
Member Author

Wouldn't it break the following

node --require ts-node/register --test-reporter=ts-reporter.ts --test test.js

Not near computer so can't verify at the moment

It will. I think the usecase of typescript reporters is less common than the issues reported by #48467 - and it can still be solved with --loader

rluvaton commented Mar 17, 2024
edited
Loading

Copy link
Copy Markdown
Member

Yes but it means that this is a breaking change

Adding label but if you think differently we can discuss

rluvaton added the semver-major PRs that contain breaking changes and should be released in the next major version. label Mar 17, 2024
MoLow added the test_runner Issues and PRs related to the test runner subsystem. label Mar 17, 2024
MoLow force-pushed the test-runner-require branch from ee77010 to ff52556 Compare April 1, 2024 07:58
MoLow requested review from aduh95, atlowChemi and cjihrig April 1, 2024 07:59
MoLow added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Apr 1, 2024
MoLow added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2024

Copy link
Copy Markdown
Collaborator

MoLow added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Apr 1, 2024

MoLow commented Apr 1, 2024

Copy link
Copy Markdown
Member Author

I need another @nodejs/tsc approval since this is marked as semver-major. PTAL

mcollina 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

lgtm

MoLow added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2024
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2024

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

MoLow added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 1, 2024

GeoffreyBooth left a comment
edited
Loading

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

It will. I think the usecase of typescript reporters is less common than the issues reported by #48467 - and it can still be solved with --loader

--loader is experimental and de facto deprecated in favor of --import. Before this lands, can someone please confirm that the following works (note that both the reporter and the test are TypeScript files):

node --import ts-node/register --test-reporter=ts-reporter.ts --test test.ts

And add a test to that effect? If not, this shouldn’t land as it replaces one bug with another.

Also if the above command works but changing --import to --require causes it to break, well, that’s another bug. I’m not sure if it’s worse than the bug that this PR is aiming to fix, so I’m not sure it’s worth blocking on that point since the remediation would be to use --import, but it’s not like we document that --require always works except when used with --test.

nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 1, 2024

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/52099
✔  Done loading data for nodejs/node/pull/52099
----------------------------------- PR info ------------------------------------
Title      test_runner: skip `--require` for test orchestration process (#52099)
Author     Moshe Atlow  (@MoLow)
Branch     MoLow:test-runner-require -> nodejs:main
Labels     semver-major, process, author ready, needs-ci, commit-queue-squash, test_runner
Commits    3
 - test_runner: skip `--require` for test orchestration process
 - CR
 - fixup! CR
Committers 1
 - Moshe Atlow 
PR-URL: https://github.com/nodejs/node/pull/52099
Reviewed-By: Colin Ihrig 
Reviewed-By: Chemi Atlow 
Reviewed-By: Matteo Collina 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/52099
Reviewed-By: Colin Ihrig 
Reviewed-By: Chemi Atlow 
Reviewed-By: Matteo Collina 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Fri, 15 Mar 2024 13:37:00 GMT
   ✘  Requested Changes: 1
   ✘  - Geoffrey Booth (@GeoffreyBooth) (TSC): https://github.com/nodejs/node/pull/52099#pullrequestreview-1972231968
   ✔  Approvals: 3
   ✔  - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/52099#pullrequestreview-1971512653
   ✔  - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/52099#pullrequestreview-1972004444
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/52099#pullrequestreview-1971723293
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-04-01T20:33:31Z: https://ci.nodejs.org/job/node-test-pull-request/58041/
- Querying data for job/node-test-pull-request/58041/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/8514547329

nodejs-github-bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Apr 1, 2024

MoLow commented Apr 2, 2024

Copy link
Copy Markdown
Member Author

that is a good point. makes me rethink about #48467 (comment)

I can't think of a good reason why preloads need to run for the main process.

registering a module hook/loader is one reason.

any thoughts on a better solution for #48467? thing is a lot of IDE's inject code to connect the debugger which breaks here

Copy link
Copy Markdown
Member

I don't know. I'm dealing with a similar problem in #52242.

MoLow closed this May 24, 2024
MoLow deleted the test-runner-require branch May 24, 2024 09:01
MoLow restored the test-runner-require branch May 24, 2024 09:01

Copy link
Copy Markdown
Member

Can we revisit this PR?

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. commit-queue-failed An error occurred while landing this 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. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. semver-major PRs that contain breaking changes and should be released in the next major 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.

V8 Inspector is not available in --require in node --test

9 participants


Back | FazBrowse Home | New Git URL