GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: improve watch mode test · nodejs/node@7d8a18b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/sequential
    • test-watch-mode.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/sequential/test-watch-mode.mjs‎

Copy file name to clipboardExpand all lines: test/sequential/test-watch-mode.mjs
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function runWriteSucceed({
6262
child.kill();
6363
cancelRestarts();
6464
}
65-
return { stdout, stderr };
65+
return { stdout, stderr, pid: child.pid };
6666
}
6767

6868
async function failWriteSucceed({ file, watchedFile }) {
@@ -259,13 +259,14 @@ console.log(values.random);
259259
]);
260260
});
261261

262-
it('should not load --require modules in main process', async () => {
262+
it('should load --require modules in the watched process, and not in the orchestrator process', async () => {
263263
const file = createTmpFile();
264-
const required = createTmpFile('setImmediate(() => process.exit(0));');
264+
const required = createTmpFile('process._rawDebug(\'pid\', process.pid);');
265265
const args = ['--require', required, file];
266-
const { stderr, stdout } = await runWriteSucceed({ file, watchedFile: file, args });
266+
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
267267

268-
assert.strictEqual(stderr, '');
268+
const importPid = parseInt(stdout[0].split(' ')[1], 10);
269+
assert.notStrictEqual(pid, importPid);
269270
assert.deepStrictEqual(stdout, [
270271
'running',
271272
`Completed running ${inspect(file)}`,
@@ -275,13 +276,14 @@ console.log(values.random);
275276
]);
276277
});
277278

278-
it('should not load --import modules in main process', async () => {
279+
it('should load --import modules in the watched process, and not in the orchestrator process', async () => {
279280
const file = createTmpFile();
280-
const imported = pathToFileURL(createTmpFile('process._rawDebug("imported");'));
281+
const imported = "data:text/javascript,process._rawDebug('pid', process.pid);";
281282
const args = ['--import', imported, file];
282-
const { stderr, stdout } = await runWriteSucceed({ file, watchedFile: file, args });
283+
const { stdout, pid } = await runWriteSucceed({ file, watchedFile: file, args });
283284

284-
assert.strictEqual(stderr, 'imported\nimported\n');
285+
const importPid = parseInt(stdout[0].split(' ')[1], 10);
286+
assert.notStrictEqual(pid, importPid);
285287
assert.deepStrictEqual(stdout, [
286288
'running',
287289
`Completed running ${inspect(file)}`,

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.