Skip to content

Commit

Permalink
fixup! test: fix some assumptions in esm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jul 29, 2023
1 parent c783660 commit ac64ca0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-internal-util-decorate-error-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ checkStack(err.stack);
// Verify that the stack is only decorated once for uncaught exceptions.
const args = [
'-e',
`require('${badSyntaxPath}')`,
`require(${JSON.stringify(badSyntaxPath)})`,
];
const result = spawnSync(process.argv[0], args, { encoding: 'utf8' });
checkStack(result.stderr);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-require-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ child.on('exit', common.mustCall(() => {

child.stdin.write('const isObject = (obj) => obj.constructor === Object;\n');
child.stdin.write('isObject({});\n');
child.stdin.write(`require('${fixture}').isObject({});\n`);
child.stdin.write(`require(${JSON.stringify(fixture)}).isObject({});\n`);
child.stdin.write('.exit');
child.stdin.end();
2 changes: 1 addition & 1 deletion test/parallel/test-stdio-pipe-stderr.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fs.writeFileSync(fakeModulePath, '', 'utf8');

stream.on('open', () => {
spawnSync(process.execPath, {
input: `require("${fakeModulePath.replace(/\\/g, '/')}")`,
input: `require(${JSON.stringify(fakeModulePath)})`,
stdio: ['pipe', 'pipe', stream]
});
const stderr = fs.readFileSync(stderrOutputPath, 'utf8').trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { isMainThread } = require('worker_threads');

if (isMainThread) {
const CODE = 'const { Worker } = require(\'worker_threads\'); ' +
`new Worker('${__filename.replace(/\\/g, '/')}', { name: 'foo' })`;
`new Worker(${JSON.stringify(__filename)}, { name: 'foo' })`;
const FILE_NAME = 'node_trace.1.log';
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-trace-events-worker-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { isMainThread } = require('worker_threads');

if (isMainThread) {
const CODE = 'const { Worker } = require(\'worker_threads\'); ' +
`new Worker('${__filename.replace(/\\/g, '/')}')`;
`new Worker(${JSON.stringify(__filename)})`;
const FILE_NAME = 'node_trace.1.log';
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
Expand Down

0 comments on commit ac64ca0

Please sign in to comment.