-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test coverage not working #8
Comments
I've since realised that Typescript can be instrumented by Istanbul / nyc, but I ran into issues using that approach too. 😞 |
Solution to my typescript instrumentation problems may be arriving soon: istanbuljs/nyc#1292 |
A few ideas have been given to do this: However failing that, and make a compromise - an alternative strategy may be to just measure the coverage of the js that is produced by typescript. Apparanelty this is what the typescript team does. |
Great news: a way forward has been found by nearly recreating the build from scratch. |
By instrumenting test coverage, we can confidently change code with the knowledge that the area is covered by tests. If an area isn't covered, then we'll be inclined to introduce tests before making changes. Once coverage is working, we'll be able to hook into tooling like code climate and coveralls to automatically reject PRs without sufficient tests.
Istanbul is the main tool js projects use to instrument code, such that running the instrumented code will report which lines of code have been run, and how many times.
What is tricky however is getting it to work with our current stack: Typescript + Rollup + Testem
Because I'm running tests in Testem, the coverage report needs to be sent via AJAX, as demonstrated in the Testem GitHub example.
I managed to get the three tools working together, with some level of coverage reporting given, but the line numbers are incorrect. This far from ideal.
These screenshots show that things clearly don't line up:
A number of sources cite source maps as the problem:
I tried stripping my entire project down to just some bare essentials, and found that when I have either comments or module imports, things get out of alignment
Without comments:
With comments:
Any help would be appreciated
The text was updated successfully, but these errors were encountered: