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 c458e84

Browse filesBrowse files
TrottBethGriggs
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 1c324d5 commit c458e84
Copy full SHA for c458e84

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
@@ -368,12 +368,6 @@ const { spawn } = require('child_process');
368368
spawn(...common.pwdCommand, { stdio: ['pipe'] });
369369
```
370370

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

379373
* `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';
@@ -723,7 +721,6 @@ const common = {
723721
platformTimeout,
724722
printSkipMessage,
725723
pwdCommand,
726-
rootDir,
727724
runWithInvalidFD,
728725
skip,
729726
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
const { getSystemErrorName } = require('util');
@@ -41,7 +44,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
4144

4245
{
4346
// Test the cwd option
44-
const cwd = common.rootDir;
47+
const cwd = tmpdir.path;
4548
const response = spawnSync(...common.pwdCommand, { cwd });
4649

4750
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');
@@ -99,7 +102,7 @@ const args = [
99102
// Verify that the cwd option works.
100103
// See https://github.com/nodejs/node-v0.x-archive/issues/7824.
101104
{
102-
const cwd = common.rootDir;
105+
const cwd = tmpdir.path;
103106
const cmd = common.isWindows ? 'echo %cd%' : 'pwd';
104107
const response = execSync(cmd, { cwd });
105108

0 commit comments

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