napi-rs/examples/napi/__tests__/unload.spec.js
forehal a781a4f27e feat(cli): brand new cli tool with both cli and programmatical usage (#1492)
BREAKING CHANGE: requires node >= 16 and some cli options have been renamed
2023-04-06 11:04:53 +08:00

11 lines
346 B
JavaScript

// use the commonjs syntax to prevent compiler from transpiling the module syntax
const test = require('ava').default
test('unload module', (t) => {
const { add } = require('../index.node')
t.is(add(1, 2), 3)
delete require.cache[require.resolve('../index.node')]
const { add: add2 } = require('../index.node')
t.is(add2(1, 2), 3)
})