Test coverage with esm modules

In my project, I am using Mocha, but with esm modules, meaning that my files use the extension ".mjs". To have Istanbul produce the correct output, I must run it with:

nyc --extension ".mjs" mocha -r esm

Currently, when I click on Run with Coverage, it produces an empty output. Is it possible to configure the command that WebStorm uses to run Istanbul?

0
2 comments

If you're using https://www.npmjs.com/package/istanbul, then .istanbul.yml is a way to configure custom parameters to istanbul runner.
If you're using https://www.npmjs.com/package/nyc, then any configuration options that can be set via the command line can also be specified in the nyc stanza of your package.json, or within a .nycrc file (https://github.com/istanbuljs/nyc#configuring-nyc).

1
Avatar
Permanently deleted user

Thank you!

1

Please sign in to leave a comment.