Heya! 🌮
I really still can't figure out how to get it working like nyc node test.js in the old days. There is no matter what the test runner is. In case, it is similar to tap(e), ava and etc. Does not use globals and etc. Does nothing to transpilation or etc, it just runs test functions in parallel and outputs TAP report.
So running node --experimental-modules test.mjs just works.
Also node --require @std/esm test.mjs.
Okey, but with nyc it not works.
nyc node --require @std/esm test.mjs
# Error: spawn-wrap: cli wrapper invoked as non-main script
nyc --require @std/esm node test.mjs
# 0 exit code, works, test pass, but not coverage report or anything
nyc --require @std/esm node --experimental-modules test.mjs
# Error [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension: /home/charlike/.node-spawn-wrap
# which not make sense, cuz everything is `.mjs` everywhere
nyc --require @std/esm node --require @std/esm test.mjs
# Error: spawn-wrap: cli wrapper invoked as non-main script
I can try use tap directly, but it still won't make much sense, cuz we should pass ---node-arg to tap..
Hi @olstenlarck!
If you create a simple repro repo. I can dig in.
Yea, check it out https://github.com/tunnckoCore/demo-esm
yarn install
yarn test
yarn cov
Thanks @olstenlarck!
You'll need to tell nyc to look for .mjs files with nyc --extension .mjs and then clear your node_modules/.cache.
One test will fail because nyc instruments your code and is visible when you toString() your function.
✖ #51 - babylon default - should parse a real function which is passed
---
name: AssertionError
message: 'cov_22srxrqji7.f[12]++;cov_22srxrqji7.s[69]++;return a+bc;' === '\n return a + bc\n '
expected: '\n return a + bc\n '
actual: 'cov_22srxrqji7.f[12]++;cov_22srxrqji7.s[69]++;return a+bc;'
at: mukla (node_modules/mukla/index.js:55:9)
Oh yea... Forgot about the extensions thing.
Yea, know about these kind of tests.That's why i have cleanup-coverage-code :D
Okey, thanks, will try.