Karma code coverage not checking mjs files on asrouter and newtab
Categories
(Firefox :: New Tab Page, task)
Tracking
()
People
(Reporter: standard8, Unassigned)
Details
In bug 1878556 I got backed out because I'd moved a .js
file to be .mjs
and added .mjs
to the list of files that Karma would check the code coverage for. Somehow I'd missed that it was failing before landing the patches.
In investigating this, I noticed that the asrouter and newtab configurations are also not checking mjs files - the regexp needs to be /\.m?js[mx]?$/
.
I tried changing the regexp, but then the tests fail as there's a lot of .sys.mjs
files that don't meet the requirements, though given that some of these have (or will?) move to being tested via xpcshell-tests, I'm not sure we need to test .sys.mjs
files. Hence NI to Mike as I'm hoping he has a better idea of how to handle this.
Comment 1•1 year ago
|
||
What I ended up doing when migrating some test to xpcshell (with thecount and pdahiya's go ahead) was to add an instanbul override and a comment explaining i - example: https://searchfox.org/mozilla-central/rev/c036a209f5a2c3163d1277ee2b7becaab2f79dbd/browser/components/newtab/karma.mc.config.js#133-141
My personal opinion is that we should be moving all of the Karma / Mocha tests that test modules (not React components) to xpcshell - but I only really did the ones that blocked ESMification. Doing so would allow us to get rid of a bunch of stubbing / simulation of the privileged Gecko environment. It also makes it easier to run the tests individually and debug them with the jsdebugger!
But I think that's ultimately a call for the owners of those modules, so cc'ing pdahiya and thecount.
Description
•