Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix addons and node-api test assumptions #55441

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/addons/repl-domain-abort/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ process.on('exit', () => {

const lines = [
// This line shouldn't cause an assertion error.
`require('${buildPath}')` +
`require(${JSON.stringify(buildPath)})` +
// Log output to double check callback ran.
'.method(function(v1, v2) {' +
'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
Expand Down
9 changes: 2 additions & 7 deletions test/node-api/test_instance_data/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ if (module !== require.main) {
function testProcessExit(addonName) {
// Make sure that process exit is clean when the instance data has
// references to JS objects.
const path = require
.resolve(`./build/${common.buildType}/${addonName}`)
// Replace any backslashes with double backslashes because they'll be re-
// interpreted back to single backslashes in the command line argument
// to the child process. Windows needs this.
.replace(/\\/g, '\\\\');
const child = spawnSync(process.execPath, ['-e', `require('${path}');`]);
const path = require.resolve(`./build/${common.buildType}/${addonName}`);
const child = spawnSync(process.execPath, ['-e', `require(${JSON.stringify(path)});`]);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.status, 0);
assert.strictEqual(child.stderr.toString(), 'addon_free');
Expand Down
7 changes: 2 additions & 5 deletions test/node-api/test_uv_threadpool_size/node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ if (process.config.variables.node_without_node_options) {
const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env';

// Should update UV_THREADPOOL_SIZE
let filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
if (common.isWindows) {
filePath = filePath.replaceAll('\\', '\\\\');
}
const filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
const code = `
const { test } = require('${filePath}');
const { test } = require(${JSON.stringify(filePath)});
const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
require('assert').strictEqual(size, 4);
test(size);
Expand Down
Loading