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: use relative paths within test directory in `test-watch-mode.mjs` · nodejs/node@86cbf80

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
+9-10Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as common from '../common/index.mjs';
22
import tmpdir from '../common/tmpdir.js';
33
import assert from 'node:assert';
4-
import os from 'node:os';
54
import path from 'node:path';
65
import { execPath } from 'node:process';
76
import { describe, it } from 'node:test';
@@ -1093,19 +1092,18 @@ process.on('message', (message) => {
10931092
// Honoring --require from NODE_OPTIONS is required for this test.
10941093
skip: !!process.config.variables.node_without_node_options,
10951094
}, async () => {
1096-
// Use /tmp to avoid CI directories with special characters (e.g. ")
1095+
// Use relative path to avoid CI directories with special characters (e.g. ")
10971096
// that would break NODE_OPTIONS parsing.
1098-
const watchDir = path.join(os.tmpdir(), 'test for --watch parsing');
1099-
mkdirSync(watchDir, { recursive: true });
1100-
const reqFile = path.join(watchDir, 'req.cjs');
1097+
const reqFile = tmpdir.resolve('req.cjs');
11011098
writeFileSync(reqFile, 'globalThis.requiredOk = true;');
11021099

11031100
const file = createTmpFile('console.log("required:" + !!globalThis.requiredOk);');
11041101
// Backslashes inside quoted NODE_OPTIONS values are escape characters.
1105-
const nodeOptions = `--watch --require "${reqFile.replaceAll(path.sep, '/')}"`;
1102+
const nodeOptions = '--watch --require ./req.cjs';
11061103
const { done, restart } = runInBackground({
11071104
args: ['--watch', file],
11081105
options: {
1106+
cwd: tmpdir.path,
11091107
env: { ...process.env, NODE_OPTIONS: nodeOptions },
11101108
},
11111109
});
@@ -1170,16 +1168,17 @@ process.on('message', (message) => {
11701168

11711169
it('should strip multiple --watch-path entries from NODE_OPTIONS', async () => {
11721170
const file = createTmpFile('console.log(process.env.NODE_OPTIONS);');
1173-
// Use /tmp to avoid CI directories with special characters (e.g. ")
1171+
// Use relative path to avoid CI directories with special characters (e.g. ")
11741172
// that would break NODE_OPTIONS parsing.
1175-
const dirA = path.join(os.tmpdir(), 'node-watch-path-a');
1176-
const dirB = path.join(os.tmpdir(), 'node-watch-path-b');
1173+
const dirA = tmpdir.resolve('node-watch-path-a');
1174+
const dirB = tmpdir.resolve('node-watch-path-b');
11771175
mkdirSync(dirA, { recursive: true });
11781176
mkdirSync(dirB, { recursive: true });
1179-
const nodeOptions = `--watch --watch-path=${dirA} --watch-path ${dirB} --no-warnings`;
1177+
const nodeOptions = '--watch --watch-path=./node-watch-path-a --watch-path ./node-watch-path-b --no-warnings';
11801178
const { done, restart } = runInBackground({
11811179
args: ['--watch', file],
11821180
options: {
1181+
cwd: tmpdir.path,
11831182
env: { ...process.env, NODE_OPTIONS: nodeOptions },
11841183
},
11851184
});

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.