test: fix test suite to work with npm 7

PR-URL: https://github.com/nodejs/node/pull/35474
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Myles Borins 2020-10-02 19:12:24 -04:00
parent 2e54524955
commit c87641aa97
No known key found for this signature in database
GPG key ID: 933B01F40B5CA946
4 changed files with 12 additions and 35 deletions

View file

@ -1384,7 +1384,7 @@ CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
# Related CI job: node-test-linter # Related CI job: node-test-linter
lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
@if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \ @if ! ( grep -IEqrs "$(CONFLICT_RE)" --exclude="error-message.js" benchmark deps doc lib src test tools ) \
&& ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \ && ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
exit 0 ; \ exit 0 ; \
else \ else \

View file

@ -12,8 +12,16 @@ const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
console.log('process.dlopen:', bindingPath); console.log('process.dlopen:', bindingPath);
process.dlopen(module, bindingPath, process.dlopen(module, bindingPath,
os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL); os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL);
console.log('module.exports.load:', `${path.dirname(bindingPath)}/ping.so`);
module.exports.load(`${path.dirname(bindingPath)}/ping.so`); let pingSOPath = `${path.dirname(bindingPath)}/lib.target/ping.so`;
if (common.isOSX) {
pingSOPath = `${path.dirname(bindingPath)}/ping.so`;
}
console.log('module.exports.load:', pingSOPath);
module.exports.load(pingSOPath);
assert.strictEqual(module.exports.ping(), 'pong'); assert.strictEqual(module.exports.ping(), 'pong');
// Check that after the addon is loaded with // Check that after the addon is loaded with

View file

@ -1,31 +0,0 @@
'use strict';
// Notarization on macOS requires all binaries to be signed.
// We sign our own binaries but check here if any binaries from our dependencies
// (e.g. npm) are signed.
const common = require('../common');
if (!common.isOSX) {
common.skip('macOS specific test');
}
const assert = require('assert');
const { spawnSync } = require('child_process');
const path = require('path');
const debuglog = require('util').debuglog('test');
const binaries = [
'deps/npm/node_modules/term-size/vendor/macos/term-size',
];
for (const testbin of binaries) {
const bin = path.resolve(__dirname, '..', '..', testbin);
debuglog(`Checking ${bin}`);
const cp = spawnSync('codesign', [ '-vvvv', bin ], { encoding: 'utf8' });
debuglog(cp.stdout);
debuglog(cp.stderr);
assert.strictEqual(cp.signal, null);
assert.strictEqual(cp.status, 0, `${bin} does not appear to be signed.\n` +
`${cp.stdout}\n${cp.stderr}`);
}

View file

@ -14,5 +14,5 @@ const npmPathPackageJson = path.resolve(
); );
const pkg = require(npmPathPackageJson); const pkg = require(npmPathPackageJson);
assert(pkg.version.match(/^\d+\.\d+\.\d+$/), assert(pkg.version.match(/^\d+\.\d+\.\d+-rc\.\d+$/),
`unexpected version number: ${pkg.version}`); `unexpected version number: ${pkg.version}`);