Skip to content

Commit ee4fa77

Browse files
authored
test: fix watch test with require not testing pid
PR-URL: #52353 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 3f8cc88 commit ee4fa77

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/sequential/test-watch-mode.mjs

+7-4
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ console.log(values.random);
307307
const file = createTmpFile();
308308
const required = createTmpFile('process._rawDebug(\'pid\', process.pid);');
309309
const args = ['--require', required, file];
310-
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
310+
const { stdout, pid, stderr } = await runWriteSucceed({ file, watchedFile: file, args });
311311

312-
const importPid = parseInt(stdout[0].split(' ')[1], 10);
312+
const importPid = parseInt(stderr[0].split(' ')[1], 10);
313313
assert.notStrictEqual(pid, importPid);
314314
assert.deepStrictEqual(stdout, [
315315
'running',
@@ -324,10 +324,13 @@ console.log(values.random);
324324
const file = createTmpFile();
325325
const imported = "data:text/javascript,process._rawDebug('pid', process.pid);";
326326
const args = ['--import', imported, file];
327-
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
327+
const { stdout, pid, stderr } = await runWriteSucceed({ file, watchedFile: file, args });
328328

329-
const importPid = parseInt(stdout[0].split(' ')[1], 10);
329+
const importPid = parseInt(stderr.split('\n', 1)[0].split(' ', 2)[1], 10);
330+
331+
assert.notStrictEqual(importPid, NaN);
330332
assert.notStrictEqual(pid, importPid);
333+
331334
assert.deepStrictEqual(stdout, [
332335
'running',
333336
`Completed running ${inspect(file)}`,

0 commit comments

Comments
 (0)