Skip to content

Commit b885f05

Browse files
aduh95targos
authored andcommitted
test: fix more tests that fail when path contains a space
PR-URL: #55088 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 85f1187 commit b885f05

4 files changed

+15
-8
lines changed

test/parallel/test-child-process-execfile.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const os = require('os');
1010

1111
const fixture = fixtures.path('exit.js');
1212
const echoFixture = fixtures.path('echo.js');
13-
const execOpts = { encoding: 'utf8', shell: true };
13+
const execOpts = { encoding: 'utf8', shell: true, env: { ...process.env, NODE: process.execPath, FIXTURE: fixture } };
1414

1515
{
1616
execFile(
@@ -46,7 +46,12 @@ const execOpts = { encoding: 'utf8', shell: true };
4646

4747
{
4848
// Verify the shell option works properly
49-
execFile(process.execPath, [fixture, 0], execOpts, common.mustSucceed());
49+
execFile(
50+
`"${common.isWindows ? execOpts.env.NODE : '$NODE'}"`,
51+
[`"${common.isWindows ? execOpts.env.FIXTURE : '$FIXTURE'}"`, 0],
52+
execOpts,
53+
common.mustSucceed(),
54+
);
5055
}
5156

5257
{

test/parallel/test-cli-node-options.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ if (process.config.variables.node_without_node_options)
66
// Test options specified by env variable.
77

88
const assert = require('assert');
9+
const path = require('path');
910
const exec = require('child_process').execFile;
1011
const { Worker } = require('worker_threads');
1112

13+
const fixtures = require('../common/fixtures');
1214
const tmpdir = require('../common/tmpdir');
1315
tmpdir.refresh();
1416

15-
const printA = require.resolve('../fixtures/printA.js');
16-
const printSpaceA = require.resolve('../fixtures/print A.js');
17+
const printA = path.relative(tmpdir.path, fixtures.path('printA.js'));
18+
const printSpaceA = path.relative(tmpdir.path, fixtures.path('print A.js'));
1719

1820
expectNoWorker(` -r ${printA} `, 'A\nB\n');
1921
expectNoWorker(`-r ${printA}`, 'A\nB\n');

test/parallel/test-startup-large-pages.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const { spawnSync } = require('child_process');
2222
[ '--use-largepages=xyzzy', '-p', '42' ]);
2323
assert.strictEqual(child.status, 9);
2424
assert.strictEqual(child.signal, null);
25-
assert.strictEqual(child.stderr.toString().match(/\S+/g).slice(1).join(' '),
26-
'invalid value for --use-largepages');
25+
assert.match(child.stderr.toString().trim(),
26+
/invalid value for --use-largepages$/);
2727
}
2828

2929
// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not

test/pseudo-tty/test-repl-external-module.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
require('../common');
44
const fixtures = require('../common/fixtures');
5-
const { execSync } = require('child_process');
5+
const { execFileSync } = require('child_process');
66

7-
execSync(process.execPath, {
7+
execFileSync(process.execPath, {
88
encoding: 'utf8',
99
stdio: 'inherit',
1010
env: {

0 commit comments

Comments
 (0)