Skip to content

Commit 62b666c

Browse files
Deepak Rajamohanmhdawson
authored andcommitted
test: run tests with opts to prefix bld root path
PR-URL: #1055 Reviewed-By: Michael Dawson <[email protected]>
1 parent cbac3aa commit 62b666c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
"bindings": "^1.5.0",
319319
"clang-format": "^1.4.0",
320320
"fs-extra": "^9.0.1",
321+
"path": "^0.12.7",
321322
"pre-commit": "^1.2.2",
322323
"safe-buffer": "^5.1.1"
323324
},

test/common/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* Test helpers ported from test/common/index.js in Node.js project. */
22
'use strict';
33
const assert = require('assert');
4+
const path = require('path');
45

56
const noop = () => {};
67

@@ -75,13 +76,13 @@ exports.mustNotCall = function(msg) {
7576
};
7677
};
7778

78-
exports.runTest = async function(test, buildType) {
79+
exports.runTest = async function(test, buildType, buildPathRoot = process.env.REL_BUILD_PATH || '') {
7980
buildType = buildType || process.config.target_defaults.default_configuration || 'Release';
8081

8182
const bindings = [
82-
`../build/${buildType}/binding.node`,
83-
`../build/${buildType}/binding_noexcept.node`,
84-
`../build/${buildType}/binding_noexcept_maybe.node`,
83+
path.join(buildPathRoot, `../build/${buildType}/binding.node`),
84+
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`),
85+
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`),
8586
].map(it => require.resolve(it));
8687

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

93-
exports.runTestWithBindingPath = async function(test, buildType) {
94+
exports.runTestWithBindingPath = async function(test, buildType, buildPathRoot = process.env.REL_BUILD_PATH || '') {
9495
buildType = buildType || process.config.target_defaults.default_configuration || 'Release';
9596

9697
const bindings = [
97-
`../build/${buildType}/binding.node`,
98-
`../build/${buildType}/binding_noexcept.node`,
99-
`../build/${buildType}/binding_noexcept_maybe.node`,
98+
path.join(buildPathRoot, `../build/${buildType}/binding.node`),
99+
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`),
100+
path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`),
100101
].map(it => require.resolve(it));
101102

102103
for (const item of bindings) {

0 commit comments

Comments
 (0)