-
Notifications
You must be signed in to change notification settings - Fork 176
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
Code coverage reports on transpiled JavaScript, instead of TypeScript source #1002
Comments
I suspect this is a duplicate of #952, which also has a workaround you may find useful. I agree it's not ideal behavior, but I don't have a sense for how extensive of a fix would be needed. |
thank you for the great work @devinivy! is it expected for this to be tackled, someday? |
Presently lab only supports js code, and you need to transform any typescript before it can be checked. Unfortunately, this conversion can inject hidden (and possibly untestable) lines of code. It can also convert what is a single statement into multiple statements. Eg. I'm not sure we will be able to solve the later issue, but the first has some potential remedies. Eg. I created my own version of lab-transform-typescript to mitigate the injected header code coverage issue, but it it very hacky and currently messes up line numbers: |
Another code level coverage problem is "enums", which creates code that cannot be covered. In |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
On HTML code coverage report, code is shown in JavaScript, instead of TypeScript. Also, code introduced by the TypeScript compiler (i.e
__importStar
,__setModuleDefaul
) is marked as not covered.$ lab --coverage --reporter html --output ./out/coverage.html --coverage-path src --coverage-all \ --coverage-pattern '^(?!.*\\.spec\\.ts)(?:.*\\.ts)$'
What was the result you got?
What result did you expect?
I expected to see the original source, in TypeScript, with the appropriate status about code coverage.
The text was updated successfully, but these errors were encountered: