mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
test: make sure tmpdir is created before using it
Otherwise it throws ENOENT when the folder happens to be cleaned PR-URL: https://github.com/nodejs/node/pull/25224 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
1ccaf9a8f1
commit
c10b131ec9
1 file changed
+4
-1
@@ -15,6 +15,8 @@ const tmpdir = require('../common/tmpdir');
|
||||
const command = common.isWindows ? 'cd' : 'pwd';
|
||||
const options = { cwd: tmpdir.path };
|
||||
|
||||
tmpdir.refresh();
|
||||
|
||||
if (common.isWindows) {
|
||||
// This test is not the case for Windows based systems
|
||||
// unless the `shell` options equals to `true`
|
||||
@@ -31,12 +33,13 @@ const testCases = [
|
||||
const expectedResult = tmpdir.path.trim().toLowerCase();
|
||||
|
||||
const results = testCases.map((testCase) => {
|
||||
const { stdout, stderr } = spawnSync(
|
||||
const { stdout, stderr, error } = spawnSync(
|
||||
command,
|
||||
testCase,
|
||||
options
|
||||
);
|
||||
|
||||
assert.ifError(error);
|
||||
assert.deepStrictEqual(stderr, Buffer.alloc(0));
|
||||
|
||||
return stdout.toString().trim().toLowerCase();
|
||||
|
||||
Reference in new issue
Block a user