diff --git a/test/addons/hello-world/test.js b/test/addons/hello-world/test.js index b0148e9d9e9014..d1d67d34f688c9 100644 --- a/test/addons/hello-world/test.js +++ b/test/addons/hello-world/test.js @@ -1,6 +1,13 @@ 'use strict'; const common = require('../../common'); const assert = require('assert'); -const binding = require(`./build/${common.buildType}/binding`); +const bindingPath = require.resolve(`./build/${common.buildType}/binding`); +const binding = require(bindingPath); assert.strictEqual(binding.hello(), 'world'); console.log('binding.hello() =', binding.hello()); + +// Test multiple loading of the same module. +delete require.cache[bindingPath]; +const rebinding = require(bindingPath); +assert.strictEqual(rebinding.hello(), 'world'); +assert.notStrictEqual(binding.hello, rebinding.hello);