diff --git a/test/addons/async-hello-world/test.js b/test/addons/async-hello-world/test.js index 14b80b711b9b35..4344605121f905 100644 --- a/test/addons/async-hello-world/test.js +++ b/test/addons/async-hello-world/test.js @@ -1,7 +1,7 @@ 'use strict'; -require('../../common'); +var common = require('../../common'); var assert = require('assert'); -var binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); var called = false; process.on('exit', function() { diff --git a/test/addons/at-exit/test.js b/test/addons/at-exit/test.js index c94453cb3b05a4..4e2ca810f01c87 100644 --- a/test/addons/at-exit/test.js +++ b/test/addons/at-exit/test.js @@ -1,3 +1,3 @@ 'use strict'; -require('../../common'); -require('./build/Release/binding'); +const common = require('../../common'); +require(`./build/${common.buildType}/binding`); diff --git a/test/addons/buffer-free-callback/test.js b/test/addons/buffer-free-callback/test.js index a70931d81e8977..dc527af2f83fe4 100644 --- a/test/addons/buffer-free-callback/test.js +++ b/test/addons/buffer-free-callback/test.js @@ -1,8 +1,8 @@ 'use strict'; // Flags: --expose-gc -require('../../common'); -var binding = require('./build/Release/binding'); +const common = require('../../common'); +const binding = require(`./build/${common.buildType}/binding`); function check(size) { var buf = binding.alloc(size); diff --git a/test/addons/heap-profiler/test.js b/test/addons/heap-profiler/test.js index 3fa00e9b86afad..32b32ddb6e6581 100644 --- a/test/addons/heap-profiler/test.js +++ b/test/addons/heap-profiler/test.js @@ -1,8 +1,8 @@ 'use strict'; -require('../../common'); +const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); // Create an AsyncWrap object. const timer = setTimeout(function() {}, 1); diff --git a/test/addons/hello-world-function-export/test.js b/test/addons/hello-world-function-export/test.js index 6dcdf39ce1c413..89127fc787c94e 100644 --- a/test/addons/hello-world-function-export/test.js +++ b/test/addons/hello-world-function-export/test.js @@ -1,6 +1,6 @@ 'use strict'; -require('../../common'); +const common = require('../../common'); var assert = require('assert'); -var binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); assert.equal('world', binding()); console.log('binding.hello() =', binding()); diff --git a/test/addons/hello-world/test.js b/test/addons/hello-world/test.js index 5637e9e6e93a3e..8d5c1238770064 100644 --- a/test/addons/hello-world/test.js +++ b/test/addons/hello-world/test.js @@ -1,6 +1,6 @@ 'use strict'; -require('../../common'); +const common = require('../../common'); var assert = require('assert'); -var binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); assert.equal('world', binding.hello()); console.log('binding.hello() =', binding.hello()); diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index a4f3cb12dc0480..ffe1c5cc6eaa2d 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -21,7 +21,10 @@ for (var i = 0; i < 10; i++) { fs.mkdirSync(addonDestinationDir); } -const addonPath = path.join(__dirname, 'build', 'Release', 'binding.node'); +const addonPath = path.join(__dirname, + 'build', + common.buildType, + 'binding.node'); const addonDestinationPath = path.join(addonDestinationDir, 'binding.node'); // Copy binary to long path destination diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index f924ac61916ba5..f1403341ce8099 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -3,7 +3,7 @@ const common = require('../../common'); const assert = require('assert'); const domain = require('domain'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const makeCallback = binding.makeCallback; // Make sure this is run in the future. diff --git a/test/addons/make-callback/test.js b/test/addons/make-callback/test.js index f3c98770ef335a..43ad014c4af478 100644 --- a/test/addons/make-callback/test.js +++ b/test/addons/make-callback/test.js @@ -3,7 +3,7 @@ const common = require('../../common'); const assert = require('assert'); const vm = require('vm'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const makeCallback = binding.makeCallback; assert.strictEqual(42, makeCallback(process, common.mustCall(function() { diff --git a/test/addons/openssl-binding/test.js b/test/addons/openssl-binding/test.js index aa515bac9a5c45..a146ffe5c68f1b 100644 --- a/test/addons/openssl-binding/test.js +++ b/test/addons/openssl-binding/test.js @@ -1,8 +1,8 @@ 'use strict'; -require('../../common'); +const common = require('../../common'); const assert = require('assert'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const bytes = new Uint8Array(1024); assert(binding.randomBytes(bytes)); assert(bytes.reduce((v, a) => v + a) > 0); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index 3f548112278cd6..dcc483fe51c7dc 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); // v8 fails silently if string length > v8::String::kMaxLength diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js index b106e3d25aa085..df96a98d3f4bd2 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js index 1df9d228d961d9..5471cd1b7191a4 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js index de27859a06e1bc..e7a067f310e7ab 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js index 4dbcf0efd86e39..21780b026aa3c6 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js index 0333bc850b5c42..dcf11390a1f718 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js index 094dee899030cc..f09770bbcc21e2 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js index ce4a488cca1d95..118cee3b2c1358 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js @@ -1,7 +1,7 @@ 'use strict'; const common = require('../../common'); -const binding = require('./build/Release/binding'); +const binding = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const skipMessage = 'intensive toString tests due to memory confinements'; diff --git a/test/common.js b/test/common.js index 2b4e432c39b9c7..a4089183eff727 100644 --- a/test/common.js +++ b/test/common.js @@ -28,6 +28,7 @@ exports.isFreeBSD = process.platform === 'freebsd'; exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */ exports.rootDir = exports.isWindows ? 'c:\\' : '/'; +exports.buildType = process.config.target_defaults.default_configuration; function rimrafSync(p) { try { diff --git a/tools/doc/addon-verify.js b/tools/doc/addon-verify.js index 299d4847ef3eb3..86a81935892745 100644 --- a/tools/doc/addon-verify.js +++ b/tools/doc/addon-verify.js @@ -65,8 +65,8 @@ function verifyFiles(files, blockName, onprogress, ondone) { files = Object.keys(files).map(function(name) { if (name === 'test.js') { files[name] = `'use strict'; -require('../../common'); -${files[name]} +const common = require('../../common'); +${files[name].replace('Release', "' + common.buildType + '")} `; } return {