node/test/addons/esm/test-import-package.js
Chengzhong Wu b6df12819d
esm: add experimental support for addon modules
PR-URL: https://github.com/nodejs/node/pull/55844
Fixes: https://github.com/nodejs/node/issues/40541
Fixes: https://github.com/nodejs/node/issues/55821
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-12-20 11:59:08 +00:00

15 lines
382 B
JavaScript

// Flags: --experimental-addon-modules
'use strict';
const common = require('../../common');
const assert = require('node:assert');
/**
* Test that the export condition `node-addons` can be used
* with `*.node` files with the ESM loader.
*/
import('esm-package/binding')
.then((mod) => {
assert.strictEqual(mod.default.hello(), 'world');
})
.then(common.mustCall());