node/test/parallel/test-permission-warning-flags.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

25 lines
556 B
JavaScript

'use strict';
require('../common');
const { spawnSync } = require('child_process');
const assert = require('assert');
const warnFlags = [
'--allow-addons',
'--allow-child-process',
'--allow-worker',
];
for (const flag of warnFlags) {
const { status, stderr } = spawnSync(
process.execPath,
[
'--experimental-permission', flag, '-e',
'setTimeout(() => {}, 1)',
]
);
assert.match(stderr.toString(), new RegExp(`SecurityWarning: The flag ${flag} must be used with extreme caution`));
assert.strictEqual(status, 0);
}