node/test/parallel/test-permission-no-addons.js
Rafael Gonzaga 918e36e0b2
src,permission: add --allow-addon flag
PR-URL: https://github.com/nodejs/node/pull/51183
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2023-12-21 17:44:11 +00:00

18 lines
584 B
JavaScript

// Flags: --experimental-permission --allow-fs-read=*
'use strict';
const common = require('../common');
common.skipIfWorker();
const { createRequire } = require('node:module');
const assert = require('node:assert');
const fixtures = require('../common/fixtures');
const loadFixture = createRequire(fixtures.path('node_modules'));
// When a permission is set by cli, the process shouldn't be able
// to require native addons unless --allow-addons is sent
{
// doesNotThrow
const msg = loadFixture('pkgexports/no-addons');
assert.strictEqual(msg, 'not using native addons');
}