test: fix addons and node-api test assumptions · nodejs/node@6aeeaa7 · GitHub
Skip to content

Commit 6aeeaa7

Browse files
aduh95ruyadorno
authored andcommitted
test: fix addons and node-api test assumptions
PR-URL: #55441 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 73ab14f commit 6aeeaa7

3 files changed

Lines changed: 5 additions & 13 deletions

File tree

test/addons/repl-domain-abort/test.js

Lines changed: 1 addition & 1 deletion

test/node-api/test_instance_data/test.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ if (module !== require.main) {
3838
function testProcessExit(addonName) {
3939
// Make sure that process exit is clean when the instance data has
4040
// references to JS objects.
41-
const path = require
42-
.resolve(`./build/${common.buildType}/${addonName}`)
43-
// Replace any backslashes with double backslashes because they'll be re-
44-
// interpreted back to single backslashes in the command line argument
45-
// to the child process. Windows needs this.
46-
.replace(/\\/g, '\\\\');
47-
const child = spawnSync(process.execPath, ['-e', `require('${path}');`]);
41+
const path = require.resolve(`./build/${common.buildType}/${addonName}`);
42+
const child = spawnSync(process.execPath, ['-e', `require(${JSON.stringify(path)});`]);
4843
assert.strictEqual(child.signal, null);
4944
assert.strictEqual(child.status, 0);
5045
assert.strictEqual(child.stderr.toString(), 'addon_free');

test/node-api/test_uv_threadpool_size/node-options.js

Lines changed: 2 additions & 5 deletions

0 commit comments

Comments
 (0)