vitest
vitest copied to clipboard
Coverage with HTML reporter (c8) for .vue + .ts files, no SFC
Describe the bug
Hi, updating vitest from 0.16 to 0.21.1 I found out the following
yarn vitest --coverage with an html reporter will throw an error when the component that is tested is not a SFC (.vue + .ts), as the reporter will list the ts file as file.ts?vue&type=script&src=true&lang.ts
The same error occurs for a project using [email protected], @vue/test-utils@1 with the last version of vitest
Rollbacking to 0.16 it seems that the ts file does not appear at all in the report, only the .vue file is listed
Sorry if I missed something in the documentation about that case !
Reproduction
https://github.com/OrestHk/vitest-coverage-no-sfc
- yarn install
- yarn vitest --coverage
System Info
System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz
Memory: 6.30 GB / 15.85 GB
Binaries:
Node: 18.7.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.15 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 104.0.5112.81
Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.47)
Internet Explorer: 11.0.19041.1566
npmPackages:
@vitejs/plugin-vue: ^3.0.1 => 3.0.1
vite: ^3.0.5 => 3.0.5
vitest: ^0.21.1 => 0.21.1
Used Package Manager
yarn
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.