diff options
author | Mithun Sasidharan <mithunsasidharan89@gmail.com> | 2017-12-13 22:40:31 +0530 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-17 13:23:03 -0500 |
commit | 3a53f7cc74d6c014eba001c83ff2953da1795f6c (patch) | |
tree | 4963e1aa00a8a1270b53ec84a48071a84d12c95e /test | |
parent | 3db136a74a34d610a0bea26f7da46ea2f33d96db (diff) | |
download | node-new-3a53f7cc74d6c014eba001c83ff2953da1795f6c.tar.gz |
test: coverage for emitExperimentalWarning
PR-URL: https://github.com/nodejs/node/pull/17635
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-util-emit-experimental-warning.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/parallel/test-util-emit-experimental-warning.js b/test/parallel/test-util-emit-experimental-warning.js new file mode 100644 index 0000000000..1c1759a428 --- /dev/null +++ b/test/parallel/test-util-emit-experimental-warning.js @@ -0,0 +1,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'); |