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 a0ba416

Browse filesBrowse files
Trottaddaleax
authored andcommitted
test: remove common.rootDir
The three tests that use common.rootDir do not need the root dir. They just need an arbitrary directory that will exist. Use tmpdir.path instead. PR-URL: #34772 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent 5352cde commit a0ba416
Copy full SHA for a0ba416

File tree

Expand file treeCollapse file tree

6 files changed

+12
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+12
-14
lines changed
Open diff view settings
Collapse file

‎test/common/README.md‎

Copy file name to clipboardExpand all lines: test/common/README.md
-6Lines changed: 0 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,6 @@ const { spawn } = require('child_process');
367367
spawn(...common.pwdCommand, { stdio: ['pipe'] });
368368
```
369369

370-
### `rootDir`
371-
372-
* [&lt;string>][]
373-
374-
Path to the 'root' directory. either `/` or `c:\\` (windows)
375-
376370
### `runWithInvalidFD(func)`
377371

378372
* `func` [&lt;Function>][]
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ const isOSX = process.platform === 'darwin';
114114

115115
const isDumbTerminal = process.env.TERM === 'dumb';
116116

117-
const rootDir = isWindows ? 'c:\\' : '/';
118-
119117
const buildType = process.config.target_defaults ?
120118
process.config.target_defaults.default_configuration :
121119
'Release';
@@ -737,7 +735,6 @@ const common = {
737735
platformTimeout,
738736
printSkipMessage,
739737
pwdCommand,
740-
rootDir,
741738
runWithInvalidFD,
742739
skip,
743740
skipIf32Bits,
Collapse file

‎test/common/index.mjs‎

Copy file name to clipboardExpand all lines: test/common/index.mjs
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const {
1919
isOSX,
2020
enoughTestMem,
2121
enoughTestCpu,
22-
rootDir,
2322
buildType,
2423
localIPv6Hosts,
2524
opensslCli,
@@ -66,7 +65,6 @@ export {
6665
isOSX,
6766
enoughTestMem,
6867
enoughTestCpu,
69-
rootDir,
7068
buildType,
7169
localIPv6Hosts,
7270
opensslCli,
Collapse file

‎test/parallel/test-child-process-cwd.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-cwd.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const tmpdir = require('../common/tmpdir');
25+
tmpdir.refresh();
26+
2427
const assert = require('assert');
2528
const { spawn } = require('child_process');
2629

@@ -63,7 +66,7 @@ function testCwd(options, expectCode = 0, expectData) {
6366
}
6467

6568
// Assume these exist, and 'pwd' gives us the right directory back
66-
testCwd({ cwd: common.rootDir }, 0, common.rootDir);
69+
testCwd({ cwd: tmpdir.path }, 0, tmpdir.path);
6770
const shouldExistDir = common.isWindows ? process.env.windir : '/dev';
6871
testCwd({ cwd: shouldExistDir }, 0, shouldExistDir);
6972

Collapse file

‎test/parallel/test-child-process-spawnsync.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-spawnsync.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const tmpdir = require('../common/tmpdir');
25+
tmpdir.refresh();
26+
2427
const assert = require('assert');
2528
const { spawnSync } = require('child_process');
2629

@@ -40,7 +43,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
4043

4144
{
4245
// Test the cwd option
43-
const cwd = common.rootDir;
46+
const cwd = tmpdir.path;
4447
const response = spawnSync(...common.pwdCommand, { cwd });
4548

4649
assert.strictEqual(response.stdout.toString().trim(), cwd);
Collapse file

‎test/sequential/test-child-process-execsync.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-child-process-execsync.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const tmpdir = require('../common/tmpdir');
25+
tmpdir.refresh();
26+
2427
const assert = require('assert');
2528

2629
const { execFileSync, execSync, spawnSync } = require('child_process');
@@ -98,7 +101,7 @@ const args = [
98101
// Verify that the cwd option works.
99102
// See https://github.com/nodejs/node-v0.x-archive/issues/7824.
100103
{
101-
const cwd = common.rootDir;
104+
const cwd = tmpdir.path;
102105
const cmd = common.isWindows ? 'echo %cd%' : 'pwd';
103106
const response = execSync(cmd, { cwd });
104107

0 commit comments

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