You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a custom file is specified for the json reporter then the output is not able to be read as the report reader is looking specifically for a file called coverage-final.json. This causes an error to be thrown.
Reproduction
Add the following to the test section of any vitest.config.ts in one of the samples (I used the basic one for the output below)
[INFO 14:30:43] [v1.2.12] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 14:30:43] [API] Running Vitest v1.4.0 (basic/vitest.config.ts) with Node.js@v20.15.1: /Users/benshelton/.nvm/versions/node/v20.15.1/bin/node
[INFO 14:30:43] [Worker] Starting inspector on 127.0.0.1:53087 failed: address already in use
[INFO 14:30:44] [API] Vitest v1.4.0 (basic/vitest.config.ts) process 38352 created
[INFO 14:30:57] [Worker] Running coverage with configuration: {
provider: 'v8',
enabled: true,
all: true,
clean: true,
cleanOnRerun: true,
reportsDirectory: '/var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788',
exclude: [
'coverage/**',
'dist/**',
'**/[.]**',
'packages/*/test?(s)/**',
'**/*.d.ts',
'**/virtual:*',
'**/__x00__*',
'**/\x00*',
'cypress/**',
'test?(s)/**',
'test?(-*).?(c|m)[jt]s?(x)',
'**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/vitest.{workspace,projects}.[jt]s?(on)',
'**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}'
],
reportOnFailure: true,
reporter: [ [ 'json', [Object] ] ],
extension: [
'.js', '.cjs',
'.mjs', '.ts',
'.mts', '.cts',
'.tsx', '.jsx',
'.vue', '.svelte',
'.marko'
],
allowExternal: false,
processingConcurrency: 10
}
[INFO 14:30:57] Running 1 file(s): src/should_included_test.ts
[14:30:57] The runner is starting because tests ***/vscode/samples/basic/src/should_included_test.ts were started due to a file change
[14:30:57] Enqueuing "should_included_test.ts"
[14:30:57] No task result for"is included because of workspace plugin setting", assuming the test just started running
[14:30:57] Marking "is included because of workspace plugin setting" as passed
[INFO 14:30:57] [Worker] Waiting for the coverage report to generate: /var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788
[INFO 14:30:57] [Worker] Coverage reports retrieved: /var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788
[14:30:57] Ending test run src/should_included_test.ts
[14:30:57] Coverage was disabled due to all requests being exhausted
[Error 14:30:57] [Error Error] Could not read coverage-final.json in /var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788. Make sure the test was run with "json" coverage enabled: Error: ENOENT: no such file or directory, open '/var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788/coverage-final.json'
Error: Could not read coverage-final.json in /var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788. Make sure the test was run with "json" coverage enabled: Error: ENOENT: no such file or directory, open '/var/folders/cz/xhwb1xys7v335hr7pzhssrx00000gn/T/vitest-coverage-fba48b1b-0317-4a1c-92b5-6d615c7f3788/coverage-final.json'
at readCoverageReport (***/vscode/src/coverage.ts:14:11)
at TestRunner.reportCoverage (***/vscode/src/runner/runner.ts:360:22)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ***/vscode/src/runner/runner.ts:109:11
Version
1.2.12
Validations
Check that you are using the latest version of the extension
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
If a custom
file
is specified for thejson
reporter then the output is not able to be read as the report reader is looking specifically for a file calledcoverage-final.json
. This causes an error to be thrown.Reproduction
Add the following to the
test
section of anyvitest.config.ts
in one of the samples (I used thebasic
one for the output below)Output
Version
1.2.12
Validations
The text was updated successfully, but these errors were encountered: