vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
728 stars 79 forks source link

Coverage not created in Monorepo #394

Closed spence-novata closed 1 month ago

spence-novata commented 1 month ago

Describe the bug

I don't believe this is a duplicate or regression of https://github.com/vitest-dev/vscode/issues/372

When running in a monorepo I'm not getting any coverage reports. If I open vscode on the individual package I get coverage fine. But in a monorepo nothing.

The test itself seems to pass (or fail) correctly. There are no errors in the Output. I pulled the path to the reportsDirectory from the output and that directory doesn't exist.

Reproduction

https://github.com/spence-novata/vitest-monorepo-coverage-repro

Output

[Worker] Running coverage with configuration: {
  provider: 'v8',
  enabled: false,
  all: false,
  clean: true,
  cleanOnRerun: true,
  reportsDirectory: '/var/folders/20/6348r3fs213djqtyzz7f3npm0000gn/T/vitest-coverage-a07c9b9c-d99c-4aa7-bac5-e49fa13c9f40',
  exclude: [
    'coverage/**',
    'dist/**',
    '**/[.]**',
    'packages/*/test?(s)/**',
    '**/*.d.ts',
    '**/virtual:*',
    '**/__x00__*',
    '**/\x00*',
    'cypress/**',
    'test?(s)/**',
    'test?(-*).?(c|m)[jt]s?(x)',
    '**/*{.,-}{test,spec}?(-d).?(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}',
    'vitest.setup.ts',
    'vitest.setup.ts',
    'vitest.setup.ts'
  ],
  reportOnFailure: true,
  reporter: [ [ 'json', {} ] ],
  extension: [
    '.js',    '.cjs',
    '.mjs',   '.ts',
    '.mts',   '.cts',
    '.tsx',   '.jsx',
    '.vue',   '.svelte',
    '.marko'
  ],
  allowExternal: false,
  ignoreEmptyLines: false,
  processingConcurrency: 10
}
[INFO 7:50:27 AM] Running 1 file(s): packages

Version

0.10.7

Validations

motss commented 1 month ago

@spence-novata Make sure your test.coverage.enabled is set to true in vite.config.ts.

spence-novata commented 1 month ago

This did the trick thank you

sheremet-va commented 1 month ago

You shouldn't need to change your config for coverage to work

motss commented 1 month ago

You shouldn't need to change your config for coverage to work

However that's not the case for the extension as it requires us to enable the coverage in our config file. This was first found here and receives np further response from the team.

sheremet-va commented 1 month ago

You shouldn't need to change your config for coverage to work

However that's not the case for the extension as it requires us to enable the coverage in our config file. This was first found here and receives np further response from the team.

This is a bug in the extension, not a feature. After that comment, there were bug fixes that removed that requirement (https://github.com/vitest-dev/vscode/releases/tag/v0.10.0). If it's still needed in some cause, this is a bug.

motss commented 1 month ago

You shouldn't need to change your config for coverage to work

However that's not the case for the extension as it requires us to enable the coverage in our config file. This was first found here and receives np further response from the team.

This is a bug in the extension, not a feature. After that comment, there were bug fixes that removed that requirement (https://github.com/vitest-dev/vscode/releases/tag/v0.10.0). If it's still needed in some cause, this is a bug.

That's new to me. Let me test that again and raise a bug if needed.