summaryrefslogtreecommitdiff
path: root/test/parallel/test-util-emit-experimental-warning.js
blob: 1c1759a428307e1bf676b95389324057b3e7ae4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
// Flags: --expose-internals
const common = require('../common');
const assert = require('assert');
const { emitExperimentalWarning } = require('internal/util');

// This test ensures that the emitExperimentalWarning in internal/util emits a
// warning when passed an unsupported feature and that it simply returns
// when passed the same feature multiple times.

process.on('warning', common.mustCall((warning) => {
  assert(/is an experimental feature/.test(warning.message));
}, 2));

emitExperimentalWarning('feature1');
emitExperimentalWarning('feature1'); // should not warn
emitExperimentalWarning('feature2');