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: fix watch test with require not testing pid #52353

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/sequential/test-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ console.log(values.random);
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 { stdout, pid, stderr } = await runWriteSucceed({ file, watchedFile: file, args });

const importPid = parseInt(stdout[0].split(' ')[1], 10);
const importPid = parseInt(stderr[0].split(' ')[1], 10);
assert.notStrictEqual(pid, importPid);
assert.deepStrictEqual(stdout, [
'running',
Expand All @@ -296,10 +296,13 @@ console.log(values.random);
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 { stdout, pid, stderr } = await runWriteSucceed({ file, watchedFile: file, args });

const importPid = parseInt(stdout[0].split(' ')[1], 10);
const importPid = parseInt(stderr.split('\n')[0].split(' ')[1], 10);
rluvaton marked this conversation as resolved.
Show resolved Hide resolved

assert.strictEqual(Number.isNaN(importPid), false);
rluvaton marked this conversation as resolved.
Show resolved Hide resolved
assert.notStrictEqual(pid, importPid);

assert.deepStrictEqual(stdout, [
'running',
`Completed running ${inspect(file)}`,
Expand Down
Loading