Skip to content

Commit

Permalink
Suppress ExperimentalWarning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Mar 26, 2022
1 parent 13ab4da commit f2a815b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lib/suppress-experimental.js
@@ -0,0 +1,13 @@
const { emitWarning } = process;

process.emitWarning = (warning, ...args) => {
if (args[0] === 'ExperimentalWarning') {
return;
}

if (args[0] && typeof args[0] === 'object' && args[0].type === 'ExperimentalWarning') {
return;
}

return emitWarning(warning, ...args);
};
1 change: 1 addition & 0 deletions lib/wrap.js
Expand Up @@ -13,6 +13,7 @@ const { extensions, fork, vm } = getConfig(script);
if (process.env.NODE_DEV_PRELOAD) {
require(process.env.NODE_DEV_PRELOAD);
}
require('./suppress-experimental');

// We want to exit on SIGTERM, but defer to existing SIGTERM handlers.
process.once('SIGTERM', () => process.listenerCount('SIGTERM') || process.exit(0));
Expand Down
2 changes: 1 addition & 1 deletion test/utils.js
Expand Up @@ -10,7 +10,7 @@ const dir = join(__dirname, 'fixture');
const reClear = new RegExp(control);

exports.spawn = (cmd, cb) => {
const ps = spawn('node', [bin, '--no-warnings'].concat(cmd.split(' ')), { cwd: dir });
const ps = spawn('node', [bin].concat(cmd.split(' ')), { cwd: dir });
let err = '';

function errorHandler(data) {
Expand Down

0 comments on commit f2a815b

Please sign in to comment.