esm+jest tests crash with console.warn()

Created on 4 Jul 2018  路  3Comments  路  Source: standard-things/esm

https://github.com/Pokute/esm-jest-warning-crash

esm+jest tests crash with console.warn()

Run npm run test to see output without errors.

Run npm run test-esm to see output with TypeError: stream.removeListener is not a function. error.

The bug reproduction requires at least two .test.js files.

bug

All 3 comments

@Pokute while the above should work in theory, just wanted to let you know that all it would be doing is to load the jest library itself with support of es modules. meaning the jest framework could be written, and loaded, with es6 modules.

regarding test code itself, esm and jest don't support each other just yet, though work is on the way ...

https://github.com/facebook/jest/issues/4842

Thanks @Pokute!

I'll dig in.

Minor note: Using npx you can make the test invocation:

"test-esm": "npx -n='-r esm' jest"

Update:

v3.0.63 is released :tada:

@jdalton may "setupFiles": "esm" in jest config be useful to avoid firing jest through npx to use esm?

Was this page helpful?
0 / 5 - 0 ratings