test: fix more tests that fail when path contains a space
PR-URL: https://github.com/nodejs/node/pull/55088 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
parent
5ed3296051
commit
2118e32d9b
@ -10,7 +10,7 @@ const os = require('os');
|
|||||||
|
|
||||||
const fixture = fixtures.path('exit.js');
|
const fixture = fixtures.path('exit.js');
|
||||||
const echoFixture = fixtures.path('echo.js');
|
const echoFixture = fixtures.path('echo.js');
|
||||||
const execOpts = { encoding: 'utf8', shell: true };
|
const execOpts = { encoding: 'utf8', shell: true, env: { ...process.env, NODE: process.execPath, FIXTURE: fixture } };
|
||||||
|
|
||||||
{
|
{
|
||||||
execFile(
|
execFile(
|
||||||
@ -46,7 +46,12 @@ const execOpts = { encoding: 'utf8', shell: true };
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Verify the shell option works properly
|
// Verify the shell option works properly
|
||||||
execFile(process.execPath, [fixture, 0], execOpts, common.mustSucceed());
|
execFile(
|
||||||
|
`"${common.isWindows ? execOpts.env.NODE : '$NODE'}"`,
|
||||||
|
[`"${common.isWindows ? execOpts.env.FIXTURE : '$FIXTURE'}"`, 0],
|
||||||
|
execOpts,
|
||||||
|
common.mustSucceed(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -6,14 +6,16 @@ if (process.config.variables.node_without_node_options)
|
|||||||
// Test options specified by env variable.
|
// Test options specified by env variable.
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const path = require('path');
|
||||||
const exec = require('child_process').execFile;
|
const exec = require('child_process').execFile;
|
||||||
const { Worker } = require('worker_threads');
|
const { Worker } = require('worker_threads');
|
||||||
|
|
||||||
|
const fixtures = require('../common/fixtures');
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
|
|
||||||
const printA = require.resolve('../fixtures/printA.js');
|
const printA = path.relative(tmpdir.path, fixtures.path('printA.js'));
|
||||||
const printSpaceA = require.resolve('../fixtures/print A.js');
|
const printSpaceA = path.relative(tmpdir.path, fixtures.path('print A.js'));
|
||||||
|
|
||||||
expectNoWorker(` -r ${printA} `, 'A\nB\n');
|
expectNoWorker(` -r ${printA} `, 'A\nB\n');
|
||||||
expectNoWorker(`-r ${printA}`, 'A\nB\n');
|
expectNoWorker(`-r ${printA}`, 'A\nB\n');
|
||||||
|
@ -22,8 +22,8 @@ const { spawnSync } = require('child_process');
|
|||||||
[ '--use-largepages=xyzzy', '-p', '42' ]);
|
[ '--use-largepages=xyzzy', '-p', '42' ]);
|
||||||
assert.strictEqual(child.status, 9);
|
assert.strictEqual(child.status, 9);
|
||||||
assert.strictEqual(child.signal, null);
|
assert.strictEqual(child.signal, null);
|
||||||
assert.strictEqual(child.stderr.toString().match(/\S+/g).slice(1).join(' '),
|
assert.match(child.stderr.toString().trim(),
|
||||||
'invalid value for --use-largepages');
|
/invalid value for --use-largepages$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not
|
// TODO(gabrielschulhof): Make assertions about the stderr, which may or may not
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
require('../common');
|
require('../common');
|
||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const { execSync } = require('child_process');
|
const { execFileSync } = require('child_process');
|
||||||
|
|
||||||
execSync(process.execPath, {
|
execFileSync(process.execPath, {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: {
|
env: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user