Skip to content

Commit

Permalink
test: fix watch test with require not testing pid
Browse files Browse the repository at this point in the history
PR-URL: #52353
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
rluvaton authored and marco-ippolito committed May 3, 2024
1 parent 9497097 commit 1f7a28c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/sequential/test-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,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 @@ -324,10 +324,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', 1)[0].split(' ', 2)[1], 10);

assert.notStrictEqual(importPid, NaN);
assert.notStrictEqual(pid, importPid);

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

0 comments on commit 1f7a28c

Please sign in to comment.