Skip to content

Commit 8db42c7

Browse files
committed
enable experimental-warning test
1 parent a696359 commit 8db42c7

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

lib/suppress-experimental-warnings.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,11 @@ module.exports = p => {
1515
return emitWarning(warning, ...args);
1616
};
1717

18-
const hasMessage = (obj, message) => {
19-
return (
20-
obj &&
21-
typeof obj === 'object' &&
22-
typeof obj.message === 'string' &&
23-
obj.message.includes(message)
24-
);
25-
};
26-
27-
// prevent experimental warning message spam on node 18+
28-
// adapted from https://github.com/yarnpkg/berry/blob/f19f67ef26f004a0b245c81a36158afc45a70504/packages/yarnpkg-pnp/sources/loader/applyPatch.ts#L414-L435
29-
p.emit = (name, data, ...args) => {
30-
if (name === 'warning' && hasMessage(data, 'Custom ESM Loaders is an experimental feature')) {
31-
return false;
18+
p.emit = (...args) => {
19+
if (args[1]?.name === 'ExperimentalWarning') {
20+
return;
3221
}
3322

34-
return emit.call(p, name, data, ...args);
23+
return emit.call(p, ...args);
3524
};
3625
};

test/spawn/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require('./conceal');
77
require('./errors');
88
require('./esmodule');
99
require('./exit-code');
10+
require('./experimental-warnings');
1011
require('./expose-gc');
1112
require('./extension-options');
1213
require('./graceful-ipc');

0 commit comments

Comments
 (0)