node/test/parallel/test-util-emit-experimental-warning.js
Michaël Zasso 508890d795
test: use assert.match instead of regexp.test
PR-URL: https://github.com/nodejs/node/pull/39928
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-08-31 18:50:16 +02:00

18 lines
633 B
JavaScript

'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.match(warning.message, /is an experimental feature/);
}, 2));
emitExperimentalWarning('feature1');
emitExperimentalWarning('feature1'); // should not warn
emitExperimentalWarning('feature2');