1
1
/* Test helpers ported from test/common/index.js in Node.js project. */
2
2
'use strict' ;
3
3
const assert = require ( 'assert' ) ;
4
+ const path = require ( 'path' ) ;
4
5
5
6
const noop = ( ) => { } ;
6
7
@@ -75,13 +76,13 @@ exports.mustNotCall = function(msg) {
75
76
} ;
76
77
} ;
77
78
78
- exports . runTest = async function ( test , buildType ) {
79
+ exports . runTest = async function ( test , buildType , buildPathRoot = process . env . REL_BUILD_PATH || '' ) {
79
80
buildType = buildType || process . config . target_defaults . default_configuration || 'Release' ;
80
81
81
82
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` ) ,
85
86
] . map ( it => require . resolve ( it ) ) ;
86
87
87
88
for ( const item of bindings ) {
@@ -90,13 +91,13 @@ exports.runTest = async function(test, buildType) {
90
91
}
91
92
}
92
93
93
- exports . runTestWithBindingPath = async function ( test , buildType ) {
94
+ exports . runTestWithBindingPath = async function ( test , buildType , buildPathRoot = process . env . REL_BUILD_PATH || '' ) {
94
95
buildType = buildType || process . config . target_defaults . default_configuration || 'Release' ;
95
96
96
97
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` ) ,
100
101
] . map ( it => require . resolve ( it ) ) ;
101
102
102
103
for ( const item of bindings ) {
0 commit comments