Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6aeeaa7

Browse filesBrowse 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
Copy full SHA for 6aeeaa7

3 files changed

+5-13Lines changed: 5 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/addons/repl-domain-abort/test.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ process.on('exit', () => {
3838

3939
const lines = [
4040
// This line shouldn't cause an assertion error.
41-
`require('${buildPath}')` +
41+
`require(${JSON.stringify(buildPath)})` +
4242
// Log output to double check callback ran.
4343
'.method(function(v1, v2) {' +
4444
'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
Collapse file

‎test/node-api/test_instance_data/test.js‎

Copy file name to clipboardExpand all lines: test/node-api/test_instance_data/test.js
+2-7Lines 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');
Collapse file

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

Copy file name to clipboardExpand all lines: test/node-api/test_uv_threadpool_size/node-options.js
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ if (process.config.variables.node_without_node_options) {
1212
const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env';
1313

1414
// Should update UV_THREADPOOL_SIZE
15-
let filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
16-
if (common.isWindows) {
17-
filePath = filePath.replaceAll('\\', '\\\\');
18-
}
15+
const filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
1916
const code = `
20-
const { test } = require('${filePath}');
17+
const { test } = require(${JSON.stringify(filePath)});
2118
const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
2219
require('assert').strictEqual(size, 4);
2320
test(size);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.