-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
c8 coverage seems broken when using import.meta.env #2540
Comments
Using |
I'm able to reproduce the issue and can fix it by modifying the C8 provider's Manipulating the |
Describe the bug
Hi,
I'm using c8 for test coverage in a Vite/Vue project and encountered an issue when using
import.meta.env
.Vue project is written in OptionAPI, and
.vue
files import.ts
files.When using
import.meta.env
in an imported.ts
file, coverage report indicate only 1 line, and 100% coverage.Commenting the line causes the coverage report to display correct values.
(Running test with
istanbul
does not raise this issue.)(Using script in
.vue
as SFC does not raise this issue.)Result:
Statements : 100% ( 7/7 )
Branches : 100% ( 0/0 )
Functions : 100% ( 0/0 )
Lines : 100% ( 7/7 )
Expected Result:
Statements : 94.73% ( 18/19 )
Branches : 50% ( 1/2 )
Functions : 100% ( 1/1 )
Lines : 94.73% ( 18/19 )
Reproduction
Here is a repository to reproduce : https://github.com/Polluux/demo-c8-issues
(Note : This repository contains multiple issues for c8)
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: