theintern / intern

A next-generation code testing stack for JavaScript.
https://theintern.io/
Other
4.36k stars 310 forks source link

Code coverage reset when re-loading module #1168

Open rhpijnacker opened 4 years ago

rhpijnacker commented 4 years ago

Since upgrading from Intern 3 to Intern 4 we have a number of files that have (much) lower code coverage.

I've been able to chase this down to test cases that use a (dojo) context require with a map to reroute dependencies to mock files. After the test case is finished, we clean up the loaded module (using require.undef) to force-load it (without mocked dependencies) the next time it is needed.

It seems that reloading a module with Intern 4 resets the coverage built up so far, whereas with Intern 3 this wasn't the case.

rhpijnacker commented 4 years ago

See https://github.com/rhpijnacker/intern-issue-1168 for a repro