Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02ebde3

Browse filesBrowse files
richardlauRafaelGSS
authored andcommitted
test: use common/tmpdir in watch-mode ipc test
Using `path.join(os.tmpdir(), 'file')` on a multi-user system can lead to file collisions where the file already exists but is owned by a different user and cannot be removed or overwritten. Other tests in `parallel/test-watch-mode-files_watcher` use `common/tmpdir` instead so switch to that for consistency. PR-URL: #45211 Refs: #44366 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
1 parent 49be13c commit 02ebde3
Copy full SHA for 02ebde3

File tree

Expand file treeCollapse file tree

2 files changed

+3
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-4
lines changed
Open diff view settings
Collapse file

‎test/fixtures/watch-mode/ipc.js‎

Copy file name to clipboardExpand all lines: test/fixtures/watch-mode/ipc.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const path = require('node:path');
22
const url = require('node:url');
3-
const os = require('node:os');
43
const fs = require('node:fs');
4+
const tmpdir = require('../../common/tmpdir');
55

6-
const tmpfile = path.join(os.tmpdir(), 'file');
6+
const tmpfile = path.join(tmpdir.path, 'file');
77
fs.writeFileSync(tmpfile, '');
88

99
process.send({ 'watch:require': path.resolve(__filename) });
Collapse file

‎test/parallel/test-watch-mode-files_watcher.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-watch-mode-files_watcher.mjs
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import tmpdir from '../common/tmpdir.js';
55
import path from 'node:path';
66
import assert from 'node:assert';
77
import process from 'node:process';
8-
import os from 'node:os';
98
import { describe, it, beforeEach, afterEach } from 'node:test';
109
import { writeFileSync, mkdirSync } from 'node:fs';
1110
import { setTimeout } from 'node:timers/promises';
@@ -153,7 +152,7 @@ describe('watch mode file watcher', () => {
153152
const child = spawn(process.execPath, [file], { stdio: ['pipe', 'pipe', 'pipe', 'ipc'], encoding: 'utf8' });
154153
watcher.watchChildProcessModules(child);
155154
await once(child, 'exit');
156-
let expected = [file, path.join(os.tmpdir(), 'file')];
155+
let expected = [file, path.join(tmpdir.path, 'file')];
157156
if (supportsRecursiveWatching) {
158157
expected = expected.map((file) => path.dirname(file));
159158
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.