Skip to content

Commit ac64ca0

Browse files
committed
fixup! test: fix some assumptions in esm tests
1 parent c783660 commit ac64ca0

5 files changed

+5
-5
lines changed

test/parallel/test-internal-util-decorate-error-stack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ checkStack(err.stack);
5858
// Verify that the stack is only decorated once for uncaught exceptions.
5959
const args = [
6060
'-e',
61-
`require('${badSyntaxPath}')`,
61+
`require(${JSON.stringify(badSyntaxPath)})`,
6262
];
6363
const result = spawnSync(process.argv[0], args, { encoding: 'utf8' });
6464
checkStack(result.stderr);

test/parallel/test-repl-require-context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ child.on('exit', common.mustCall(() => {
1919

2020
child.stdin.write('const isObject = (obj) => obj.constructor === Object;\n');
2121
child.stdin.write('isObject({});\n');
22-
child.stdin.write(`require('${fixture}').isObject({});\n`);
22+
child.stdin.write(`require(${JSON.stringify(fixture)}).isObject({});\n`);
2323
child.stdin.write('.exit');
2424
child.stdin.end();

test/parallel/test-stdio-pipe-stderr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fs.writeFileSync(fakeModulePath, '', 'utf8');
2222

2323
stream.on('open', () => {
2424
spawnSync(process.execPath, {
25-
input: `require("${fakeModulePath.replace(/\\/g, '/')}")`,
25+
input: `require(${JSON.stringify(fakeModulePath)})`,
2626
stdio: ['pipe', 'pipe', stream]
2727
});
2828
const stderr = fs.readFileSync(stderrOutputPath, 'utf8').trim();

test/parallel/test-trace-events-worker-metadata-with-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { isMainThread } = require('worker_threads');
77

88
if (isMainThread) {
99
const CODE = 'const { Worker } = require(\'worker_threads\'); ' +
10-
`new Worker('${__filename.replace(/\\/g, '/')}', { name: 'foo' })`;
10+
`new Worker(${JSON.stringify(__filename)}, { name: 'foo' })`;
1111
const FILE_NAME = 'node_trace.1.log';
1212
const tmpdir = require('../common/tmpdir');
1313
tmpdir.refresh();

test/parallel/test-trace-events-worker-metadata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { isMainThread } = require('worker_threads');
77

88
if (isMainThread) {
99
const CODE = 'const { Worker } = require(\'worker_threads\'); ' +
10-
`new Worker('${__filename.replace(/\\/g, '/')}')`;
10+
`new Worker(${JSON.stringify(__filename)})`;
1111
const FILE_NAME = 'node_trace.1.log';
1212
const tmpdir = require('../common/tmpdir');
1313
tmpdir.refresh();

0 commit comments

Comments
 (0)