ts-node-test icon indicating copy to clipboard operation
ts-node-test copied to clipboard

Disable experimental warning

Open shwao opened this issue 3 years ago • 1 comments

I get the message (node:5051) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time for every test that runs. That kind of clutters the logs. This could be disabled by adding '--no-warnings=ExperimentalWarning' to the args in this line: https://github.com/meyfa/ts-node-test/blob/d92bf100b6fe3292963fe466982dc0d4a4c6f180/src/index.ts#L45

Would you accept in a PR from me for this change? Or should it be behind a flag/option?

shwao avatar Apr 06 '23 18:04 shwao

I would be open to disabling this warning. Unfortunately it's not as simple, since Node.js doesn't actually support the --no-warnings=ExperimentalWarning syntax. Relevant discussion: https://github.com/nodejs/node/issues/46862, and a PR to make the Node.js documentation reflect its behavior: https://github.com/nodejs/node/pull/47031

Even then, this would disable all ExperimentalWarnings, even ones caused by the code under test, which doesn't feel optimal.

Right now, it's already possible to disable these warnings via the NODE_OPTIONS environment variable:

NODE_OPTIONS=--no-warnings ts-node-test test/

I'll gladly accept a PR for either of the following:

  • Adding support for passing --no-warnings directly to ts-node-test, i.e., ts-node-test --no-warnings test/
  • Suppressing the ExperimentalWarning for ESM loaders specifically (but not all other warnings, too)

meyfa avatar Apr 06 '23 22:04 meyfa