Skip to content
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

Nuxt/i18n v9.1.0 breaks Vitest code coverage #3238

Open
antoinezanardi opened this issue Nov 19, 2024 · 4 comments
Open

Nuxt/i18n v9.1.0 breaks Vitest code coverage #3238

antoinezanardi opened this issue Nov 19, 2024 · 4 comments

Comments

@antoinezanardi
Copy link

Environment

Nuxt project info:


  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: 3.14.159
  • CLI Version: 3.15.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: default
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

You can reproduce the bug with the StackBlitz here : https://stackblitz.com/edit/nuxt-starter-gpaujj?file=package.json

Run the following commands :

npm i
vitest --coverage

Describe the bug

When using Vitest to generate code coverage (with either v8 or istanbul), it appears that v9.1.0 introduces a bug that breaks the generated coverage files and their output.

Observed Behavior:

  • In the provided reproduction, the generated file coverage/final-coverage.json contains only {}, which is incorrect.
  • The console output shows no files being covered, even though this is inaccurate.

Expected Behavior:

  • The coverage/final-coverage.json file should correctly represent the coverage data.
  • The console output should accurately reflect the covered files.

Temporary Fix:

Reverting to v9.0.0 resolves the issue and restores normal functionality.

Additional context

You can also see that something's wrong one the PR that updates the package on a larger project of mine, with this job : https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/runs/11915097536

(It checks that the coverage results are not empty).

Logs

@BobbieGoede
Copy link
Collaborator

I have no idea how this module could influence the coverage generation 🤔 Unfortunately I can't confirm this is caused by this module using the provided reproduction, even when removing Nuxt I18n, the generated coverage file seems to only contain {}. Maybe I'm doing something wrong, can you check if this is the case for you as well?

@antoinezanardi
Copy link
Author

It looks like I can't reproduce it well either… That's a shame !

However, as odd as it is, I can assure that upgrading the version to 9.1.0 actually breaks the coverage on my project here : https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/runs/11915097536

Back to the reproduction, I think that StackBlitz as some issues with coverage reporters… Maybe running it local will be different ?

@BobbieGoede
Copy link
Collaborator

I just tried it debugging the issue using the werewolves-assistant-web-next project.

You're right that updating to 9.1.0 seems to break the coverage generation, but installing 9.0.0 again afterwards leaves the coverage generation broken, I guess strictly speaking this means a sub dependency (higher version) is breaking the coverage generation. I'll try and see if I can narrow it down further.

@antoinezanardi
Copy link
Author

Thanks a lot for your investigation.

You're right, downgrading it after that won't resolve the issue. I had to rollback the package-lock.json from a previous working build to make it work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants