summaryrefslogtreecommitdiff
path: root/test/node-api/1_hello_world/test.js
blob: d1d67d34f688c90aafc459fdbdd3b707d5dea37f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
'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);