Skip to content

Commit 373d5df

Browse files
mithunsasidharanMylesBorins
authored andcommitted
test: coverage for emitExperimentalWarning
PR-URL: #17635 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent e059bc5 commit 373d5df

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
// Flags: --expose-internals
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const { emitExperimentalWarning } = require('internal/util');
6+
7+
// This test ensures that the emitExperimentalWarning in internal/util emits a
8+
// warning when passed an unsupported feature and that it simply returns
9+
// when passed the same feature multiple times.
10+
11+
process.on('warning', common.mustCall((warning) => {
12+
assert(/is an experimental feature/.test(warning.message));
13+
}, 2));
14+
15+
emitExperimentalWarning('feature1');
16+
emitExperimentalWarning('feature1'); // should not warn
17+
emitExperimentalWarning('feature2');

0 commit comments

Comments
 (0)