When Intern tests don't load source files (0% covered), they don't show up in the (lcov) coverage report (running in nodejs).
Typically a problem JS tools struggle with, I think.
E.g. Jest has a simple workaround.
I'm looking for the simplest workaround for intern, ideally with v3.
istanbul
under the cover, wonder if --include-all-source
flag works and can be passed easily? Taking a look at the Intern project itself and in the config script there is such an option called coverage
, coverage is defined as:
An array of file paths or globs that should be instrumented for code coverage, or false to completely disable coverage. This property should point to the actual JavaScript files that will be executed, not pre-transpiled sources (coverage results will still be mapped back to original sources). Coverage data will be collected for these files even if they’re not loaded by Intern for tests, ALLOWING A TEST WRITER TO SEE WHICH FILES HAVENT BEEN TESTED writer to see which files haven’t been tested, as well as coverage on files that were tested. When this value is unset, Intern will still look for coverage data on a global coverage variable, and it will request coverage data from remote sessions. Explicitly setting coverage to false will prevent Intern from even checking for coverage data. 💡This property replaces the
excludeInstrumentation
property used in previous versions of Intern, which acted as a filter rather than an inclusive list.
Sorry for the uppercase, where just suppose to highlight the sentence.
coverage
uses glob just as istanbul does, so you could specify something like coverage: ['src/**/*.js']
.
I realize this because Intern itself uses this configuration to collect coverage and it seems to work for them.
Edit: As pointed in the comments, this features only appears in v4 of intern.