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

Root Workspace causes coverage to throw no results error #372

Closed
ericchernuka opened this issue May 3, 2024 · 4 comments
Closed

Root Workspace causes coverage to throw no results error #372

ericchernuka opened this issue May 3, 2024 · 4 comments
Labels
p5-urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)

Comments

@ericchernuka
Copy link

ericchernuka commented May 3, 2024

Describe the bug

I've experienced this in our work project but I decided to start fresh and also utilize a sample project to determine if it was just a setup problem I introduced. Upon opening a a PNPM monorepo project with a Vitest workspace defined at the root I am able to see all the tests and run the entire suite, run a single test, and run tests continuously. The issue arises when attempting to leverage the coverage feature. After adding v8 as a dependency and then attempting to run the coverage through the extension, I receive an error regarding VSCode being unable to read results of null. After digging in a bit, it seems as though the merge coverage feature isn't receiving any output and its then throwing an error.

I did validate that the coverage feature works as intended if the workspace file is deleted.

Reproduction

I was able to repro this behaviour in the current version of main in the repo using the following sample: https://github.com/vitest-dev/vscode/tree/main/samples/monorepo-vitest-workspace

Output

[Worker] Running coverage with configuration: {
  provider: 'v8',
  enabled: false,
  all: true,
  clean: true,
  cleanOnRerun: true,
  reportsDirectory: '/var/folders/w6/rvbn81tx2x5gl02kqsx854hh0000gn/T/vitest-coverage-38eb8583-5921-4a73-ac61-534033ab6ef5',
  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', {} ] ],
  extension: [
    '.js',    '.cjs',
    '.mjs',   '.ts',
    '.mts',   '.cts',
    '.tsx',   '.jsx',
    '.vue',   '.svelte',
    '.marko'
  ],
  allowExternal: false,
  ignoreEmptyLines: false,
  processingConcurrency: 10
}
[Worker] 2024-05-03T13:03:08.258Z vite:resolve 0.65ms @vitest/coverage-v8 -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vitest/coverage-v8/dist/index.js
[INFO 7:03:08 AM] Running 1 file(s): packages/react copy/test/basic.test.tsx
[Worker] 2024-05-03T13:03:08.392Z vite:resolve 0.14ms /@vite/env -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]/node_modules/vite/dist/client/env.mjs
[Worker] 2024-05-03T13:03:08.393Z vite:resolve 0.03ms /@vite/env -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]/node_modules/vite/dist/client/env.mjs
[Worker] 2024-05-03T13:03:08.393Z vite:load 0.86ms [fs] /@vite/env
[Worker] 2024-05-03T13:03:08.394Z vite:load 0.99ms [fs] /@vite/env
[Worker] 2024-05-03T13:03:08.395Z vite:import-analysis 0.33ms [no imports] /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]/node_modules/vite/dist/client/env.mjs
2024-05-03T13:03:08.395Z vite:transform 0.87ms /@vite/env
[Worker] 2024-05-03T13:03:08.398Z vite:import-analysis 0.04ms [no imports] node_modules/.pnpm/[email protected]/node_modules/vite/dist/client/env.mjs
2024-05-03T13:03:08.398Z vite:transform 0.23ms /@vite/env
[Worker] 2024-05-03T13:03:08.433Z vite:load 0.16ms [fs] /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
2024-05-03T13:03:08.434Z vite:resolve 0.29ms vitest -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/index.js
2024-05-03T13:03:08.435Z vite:import-analysis 1.49ms [1 imports rewritten] /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
2024-05-03T13:03:08.435Z vite:transform 1.61ms /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
2024-05-03T13:03:08.456Z vite:load 0.19ms [fs] test/basic.test.tsx
2024-05-03T13:03:08.458Z vite:resolve 0.25ms ../components/Link -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/packages/react copy/components/Link.tsx
2024-05-03T13:03:08.458Z vite:resolve 0.03ms /components/Link.tsx -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/packages/react copy/components/Link.tsx
2024-05-03T13:03:08.458Z vite:import-analysis 1.04ms [2 imports rewritten] test/basic.test.tsx
2024-05-03T13:03:08.458Z vite:transform 2.42ms test/basic.test.tsx
2024-05-03T13:03:08.460Z vite:resolve 0.21ms react -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]/node_modules/react/index.js
2024-05-03T13:03:08.464Z vite:resolve 0.26ms react-test-renderer -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/react-test-renderer/index.js
2024-05-03T13:03:08.478Z vite:load 2.19ms [fs] /components/Link.tsx
2024-05-03T13:03:08.481Z vite:import-analysis 0.20ms [0 imports rewritten] components/Link.tsx
2024-05-03T13:03:08.481Z vite:transform 2.37ms /components/Link.tsx
[Worker] 2024-05-03T13:03:08.490Z vite:load 2.40ms [fs] /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
2024-05-03T13:03:08.491Z vite:resolve 0.28ms vitest -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/vitest/dist/index.js
2024-05-03T13:03:08.491Z vite:import-analysis 0.72ms [1 imports rewritten] /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
2024-05-03T13:03:08.491Z vite:transform 0.80ms /Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/setupFile.mjs
[Worker] 2024-05-03T13:03:08.498Z vite:load 0.46ms [fs] packages/react copy/test/basic.test.tsx
[Worker] 2024-05-03T13:03:08.500Z vite:resolve 0.82ms react -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected]/node_modules/react/index.js
2024-05-03T13:03:08.500Z vite:resolve 0.86ms react-test-renderer -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/react-test-renderer/index.js
2024-05-03T13:03:08.500Z vite:resolve 0.87ms ../components/Link -> /Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/packages/react copy/components/Link.tsx
[Worker] 2024-05-03T13:03:08.500Z vite:import-analysis 1.28ms [4 imports rewritten] packages/react copy/test/basic.test.tsx
2024-05-03T13:03:08.500Z vite:transform 2.68ms packages/react copy/test/basic.test.tsx
[Worker] 2024-05-03T13:03:08.517Z vite:load 0.23ms [fs] /packages/react copy/components/Link.tsx
2024-05-03T13:03:08.518Z vite:import-analysis 0.20ms [1 imports rewritten] packages/react copy/components/Link.tsx
2024-05-03T13:03:08.518Z vite:transform 1.06ms /packages/react copy/components/Link.tsx
[Worker] 2024-05-03T13:03:08.539Z vitest:coverage Covered files 2/4
[Error 7:03:08 AM] [Error TypeError] Cannot read properties of null (reading 'result')
TypeError: Cannot read properties of null (reading 'result')
    at mergeProcessCovs (/Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/@[email protected]/node_modules/@bcoe/v8-coverage/dist/lib/merge.js:22:44)
    at file:///Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vitest/coverage-v8/dist/provider.js:2304:22
    at async Promise.all (index 1)
    at async V8CoverageProvider.reportCoverage (file:///Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vitest/coverage-v8/dist/provider.js:2301:11)
    at async Vitest.reportCoverage (file:///Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/vitest/dist/vendor/cli-api.AmIc1Dmz.js:11378:7)
    at async file:///Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/vitest/dist/vendor/cli-api.AmIc1Dmz.js:11153:7
    at async Vitest.runFiles (file:///Users/ec/Code/vitest-vscode-ext/samples/monorepo-vitest-workspace/node_modules/.pnpm/[email protected][email protected]/node_modules/vitest/dist/vendor/cli-api.AmIc1Dmz.js:11159:12)
    at async t.rerunTests (/Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/worker.js:3:6057)
    at async t.runTestFiles (/Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/worker.js:3:5851)
    at async t.runTests (/Users/ec/.vscode/extensions/vitest.explorer-0.8.6/dist/worker.js:3:5333)


### Version

v0.8.6

### Validations

- [X] Check that you are using the latest version of the extension
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vscode/issues) 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](https://github.com/vitest-dev/vscode/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@ffMathy
Copy link
Collaborator

ffMathy commented May 3, 2024

This is basically a duplicate of #339, which was closed due to lack of reproduction.

@ericchernuka
Copy link
Author

@ffMathy Sorry about that. I promise I looked, but somehow missed this :(

@ffMathy
Copy link
Collaborator

ffMathy commented May 3, 2024

Oh, don't apologize! The issue was never solved, and I didn't close it, so it's good to re-open. It was just for some context.

@sheremet-va sheremet-va added p5-urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) and removed pending triage labels May 6, 2024
@sheremet-va
Copy link
Member

Thank you, I can reproduce it with a vitest.workspace file.

@github-actions github-actions bot locked and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p5-urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)
Projects
None yet
Development

No branches or pull requests

3 participants