Skip to content

Commit

Permalink
test: run tests with opts to prefix bld root path
Browse files Browse the repository at this point in the history
PR-URL: #1055
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
Deepak Rajamohan authored and mhdawson committed Sep 10, 2021
1 parent cbac3aa commit 62b666c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
"bindings": "^1.5.0",
"clang-format": "^1.4.0",
"fs-extra": "^9.0.1",
"path": "^0.12.7",
"pre-commit": "^1.2.2",
"safe-buffer": "^5.1.1"
},
Expand Down
17 changes: 9 additions & 8 deletions test/common/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Test helpers ported from test/common/index.js in Node.js project. */
'use strict';
const assert = require('assert');
const path = require('path');

const noop = () => {};

Expand Down Expand Up @@ -75,13 +76,13 @@ exports.mustNotCall = function(msg) {
};
};

exports.runTest = async function(test, buildType) {
exports.runTest = async function(test, buildType, buildPathRoot = process.env.REL_BUILD_PATH || '') {
buildType = buildType || process.config.target_defaults.default_configuration || 'Release';

const bindings = [
`../build/${buildType}/binding.node`,
`../build/${buildType}/binding_noexcept.node`,
`../build/${buildType}/binding_noexcept_maybe.node`,
path.join(buildPathRoot, `../build/${buildType}/binding.node`),
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`),
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`),
].map(it => require.resolve(it));

for (const item of bindings) {
Expand All @@ -90,13 +91,13 @@ exports.runTest = async function(test, buildType) {
}
}

exports.runTestWithBindingPath = async function(test, buildType) {
exports.runTestWithBindingPath = async function(test, buildType, buildPathRoot = process.env.REL_BUILD_PATH || '') {
buildType = buildType || process.config.target_defaults.default_configuration || 'Release';

const bindings = [
`../build/${buildType}/binding.node`,
`../build/${buildType}/binding_noexcept.node`,
`../build/${buildType}/binding_noexcept_maybe.node`,
path.join(buildPathRoot, `../build/${buildType}/binding.node`),
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`),
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`),
].map(it => require.resolve(it));

for (const item of bindings) {
Expand Down

0 comments on commit 62b666c

Please sign in to comment.