mirror of
https://github.com/nodejs/node.git
synced 2025-05-11 19:50:13 +00:00

Re-`require()` the addon after clearing its cache to ensure that it is re-initialized via the well-known symbol. PR-URL: https://github.com/nodejs/node/pull/19875 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
14 lines
523 B
JavaScript
14 lines
523 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
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);
|