test-utils icon indicating copy to clipboard operation
test-utils copied to clipboard

Coverage report does not get generated if `srcDir` in `nuxt.config.js` is modified.

Open cadenzah opened this issue 8 months ago • 3 comments

Environment

Working directory: /home/projects/github-h9agvz Nuxt project info:


  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: 3.12.2
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, srcDir
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-h9agvz?file=vitest.config.ts,nuxt.config.ts

Describe the bug

The coverage report (by either v8 or istanbul) does not get generated if I change the srcDir configuration in nuxt.config.js. It seems it works well if I use the default setting. You can reproduce the issue with the link I provided.

If I click on the Coverage icon button on vitest-ui web page, It shows the error text: Cannot GET /coverage/index.html.

If I run vitest with --ui and coverage.enabled option to true then the coverage report's html files should be generated in /coverage directory, but what I get is only tmp directory with coverage.json files included. It seems the .html files are not generated properly so that the output directory get empty.

I even tried to change reportsDirectory or root in vitest.config.js but nothing changes.

Additional context

Sometimes if I run vitest --ui then after the preparation is ready, the open browser should show the Vitest UI, but it shows Cannot GET /. After that if I click the URL printed on the console (UI started at http://localhost:51204/vitest/), then it goes to the UI page. Also, if I click the Coverage icon on that page, it shows the error text of Cannot GET /coverage/index.html as well.

Logs

No response

cadenzah avatar Jun 23 '24 06:06 cadenzah