Skip to content

Commit bdad8d7

Browse files
committed
Add explicit test of disable-warning behaviour
1 parent 5e4da4d commit bdad8d7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/parallel/test-permission-warning-flags.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,17 @@ for (const flag of warnFlags) {
2828
assert.match(stderr.toString(), new RegExp(`\\[PERM\\d{4}\\] SecurityWarning: The flag ${RegExp.escape(flag)} must be used with extreme caution`));
2929
assert.strictEqual(status, 0);
3030
}
31+
32+
const { status, stderr } = spawnSync(
33+
process.execPath,
34+
[
35+
'--permission', '--allow-child-process', '--allow-wasi', '--disable-warning=PERM0002', '-e',
36+
'setTimeout(() => {}, 1)',
37+
]
38+
);
39+
40+
// Disabled warning does not appear
41+
assert.doesNotMatch(stderr.toString(), new RegExp(`The flag --allow-child-process must be used with extreme caution`));
42+
// But non-disabled warnings still appear
43+
assert.match(stderr.toString(), new RegExp(`The flag --allow-wasi must be used with extreme caution`));
44+
assert.strictEqual(status, 0);

0 commit comments

Comments
 (0)