mirror of https://github.com/nodejs/node.git
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: https://github.com/nodejs/node/pull/34772 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>pull/34772/head
parent
0e1fd8d0b4
commit
42a3a7f97d
|
@ -369,12 +369,6 @@ const { spawn } = require('child_process');
|
|||
spawn(...common.pwdCommand, { stdio: ['pipe'] });
|
||||
```
|
||||
|
||||
### `rootDir`
|
||||
|
||||
* [<string>][]
|
||||
|
||||
Path to the 'root' directory. either `/` or `c:\\` (windows)
|
||||
|
||||
### `runWithInvalidFD(func)`
|
||||
|
||||
* `func` [<Function>][]
|
||||
|
|
|
@ -115,8 +115,6 @@ const isOSX = process.platform === 'darwin';
|
|||
|
||||
const isDumbTerminal = process.env.TERM === 'dumb';
|
||||
|
||||
const rootDir = isWindows ? 'c:\\' : '/';
|
||||
|
||||
const buildType = process.config.target_defaults ?
|
||||
process.config.target_defaults.default_configuration :
|
||||
'Release';
|
||||
|
@ -726,7 +724,6 @@ const common = {
|
|||
platformTimeout,
|
||||
printSkipMessage,
|
||||
pwdCommand,
|
||||
rootDir,
|
||||
runWithInvalidFD,
|
||||
skip,
|
||||
skipIf32Bits,
|
||||
|
|
|
@ -19,7 +19,6 @@ const {
|
|||
isOSX,
|
||||
enoughTestMem,
|
||||
enoughTestCpu,
|
||||
rootDir,
|
||||
buildType,
|
||||
localIPv6Hosts,
|
||||
opensslCli,
|
||||
|
@ -66,7 +65,6 @@ export {
|
|||
isOSX,
|
||||
enoughTestMem,
|
||||
enoughTestCpu,
|
||||
rootDir,
|
||||
buildType,
|
||||
localIPv6Hosts,
|
||||
opensslCli,
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
tmpdir.refresh();
|
||||
|
||||
const assert = require('assert');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
|
@ -63,7 +66,7 @@ function testCwd(options, expectCode = 0, expectData) {
|
|||
}
|
||||
|
||||
// Assume these exist, and 'pwd' gives us the right directory back
|
||||
testCwd({ cwd: common.rootDir }, 0, common.rootDir);
|
||||
testCwd({ cwd: tmpdir.path }, 0, tmpdir.path);
|
||||
const shouldExistDir = common.isWindows ? process.env.windir : '/dev';
|
||||
testCwd({ cwd: shouldExistDir }, 0, shouldExistDir);
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
tmpdir.refresh();
|
||||
|
||||
const assert = require('assert');
|
||||
const { spawnSync } = require('child_process');
|
||||
const { getSystemErrorName } = require('util');
|
||||
|
@ -41,7 +44,7 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
|
|||
|
||||
{
|
||||
// Test the cwd option
|
||||
const cwd = common.rootDir;
|
||||
const cwd = tmpdir.path;
|
||||
const response = spawnSync(...common.pwdCommand, { cwd });
|
||||
|
||||
assert.strictEqual(response.stdout.toString().trim(), cwd);
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
tmpdir.refresh();
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const { execFileSync, execSync, spawnSync } = require('child_process');
|
||||
|
@ -99,7 +102,7 @@ const args = [
|
|||
// Verify that the cwd option works.
|
||||
// See https://github.com/nodejs/node-v0.x-archive/issues/7824.
|
||||
{
|
||||
const cwd = common.rootDir;
|
||||
const cwd = tmpdir.path;
|
||||
const cmd = common.isWindows ? 'echo %cd%' : 'pwd';
|
||||
const response = execSync(cmd, { cwd });
|
||||
|
||||
|
|
Loading…
Reference in New Issue