mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: fix addons and node-api test assumptions
PR-URL: https://github.com/nodejs/node/pull/55441 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
eb63cd24d2
commit
47ad609d64
@ -38,7 +38,7 @@ process.on('exit', () => {
|
|||||||
|
|
||||||
const lines = [
|
const lines = [
|
||||||
// This line shouldn't cause an assertion error.
|
// This line shouldn't cause an assertion error.
|
||||||
`require('${buildPath}')` +
|
`require(${JSON.stringify(buildPath)})` +
|
||||||
// Log output to double check callback ran.
|
// Log output to double check callback ran.
|
||||||
'.method(function(v1, v2) {' +
|
'.method(function(v1, v2) {' +
|
||||||
'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
|
'console.log(\'cb_ran\'); return v1 === true && v2 === false; });',
|
||||||
|
@ -38,13 +38,8 @@ if (module !== require.main) {
|
|||||||
function testProcessExit(addonName) {
|
function testProcessExit(addonName) {
|
||||||
// Make sure that process exit is clean when the instance data has
|
// Make sure that process exit is clean when the instance data has
|
||||||
// references to JS objects.
|
// references to JS objects.
|
||||||
const path = require
|
const path = require.resolve(`./build/${common.buildType}/${addonName}`);
|
||||||
.resolve(`./build/${common.buildType}/${addonName}`)
|
const child = spawnSync(process.execPath, ['-e', `require(${JSON.stringify(path)});`]);
|
||||||
// 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}');`]);
|
|
||||||
assert.strictEqual(child.signal, null);
|
assert.strictEqual(child.signal, null);
|
||||||
assert.strictEqual(child.status, 0);
|
assert.strictEqual(child.status, 0);
|
||||||
assert.strictEqual(child.stderr.toString(), 'addon_free');
|
assert.strictEqual(child.stderr.toString(), 'addon_free');
|
||||||
|
@ -12,12 +12,9 @@ if (process.config.variables.node_without_node_options) {
|
|||||||
const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env';
|
const uvThreadPoolPath = '../../fixtures/dotenv/uv-threadpool.env';
|
||||||
|
|
||||||
// Should update UV_THREADPOOL_SIZE
|
// Should update UV_THREADPOOL_SIZE
|
||||||
let filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
|
const filePath = path.join(__dirname, `./build/${common.buildType}/test_uv_threadpool_size`);
|
||||||
if (common.isWindows) {
|
|
||||||
filePath = filePath.replaceAll('\\', '\\\\');
|
|
||||||
}
|
|
||||||
const code = `
|
const code = `
|
||||||
const { test } = require('${filePath}');
|
const { test } = require(${JSON.stringify(filePath)});
|
||||||
const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
|
const size = parseInt(process.env.UV_THREADPOOL_SIZE, 10);
|
||||||
require('assert').strictEqual(size, 4);
|
require('assert').strictEqual(size, 4);
|
||||||
test(size);
|
test(size);
|
||||||
|
Loading…
Reference in New Issue
Block a user