node/test/addons/no-addons/test.js
Antoine du Hamel ba7cdf4a92
test: ensure assertions are reachable in test/addons
PR-URL: https://github.com/nodejs/node/pull/60142
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-25 20:44:28 +02:00

17 lines
522 B
JavaScript

// Flags: --no-addons
'use strict';
const common = require('../../common');
const assert = require('assert');
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
assert.throws(() => require(bindingPath), {
code: 'ERR_DLOPEN_DISABLED',
message: 'Cannot load native addon because loading addons is disabled.',
});
assert.throws(() => process.dlopen({ exports: {} }, bindingPath), {
code: 'ERR_DLOPEN_DISABLED',
message: 'Cannot load native addon because loading addons is disabled.',
});