11/* Test helpers ported from test/common/index.js in Node.js project. */
22'use strict' ;
33const assert = require ( 'assert' ) ;
4+ const path = require ( 'path' ) ;
45
56const 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