-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurepending triage
Description
Describe the bug
Hi. I noticed in Vitest 4, if you have a React component which is defined as an inline, the coverage won't work when using v8.
If you switch to istanbul, everything is okay. This wasn't an issue for me in vitest 3. In the lcov report it shows up like this
Even though I definitely have a test for this component
Reproduction
export const SomeComponent = () => <div>Some simple component</div>And test file
import { screen } from "@testing-library/react";
import { SomeComponent } from './SomeComponent.tsx';
describe('<SomeComponent />', () => {
it('should render without crashing', () => {
render(<SomeComponent />);
expect(screen)).toHaveTextContent("Some simple component");
})
})System Info
System:
OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
Memory: 28.45 GB / 31.98 GB
Container: No
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 25.0.0 - /home/hugo/.nvm/versions/node/v25.0.0/bin/node
npm: 11.7.0 - /home/hugo/.nvm/versions/node/v25.0.0/bin/npm
Browsers:
Chrome: 142.0.7444.175
Firefox: 145.0.2
Firefox Developer Edition: 145.0.2
npmPackages:
@vitest/coverage-v8: ^4.0.16 => 4.0.16
vite: ^7.3.0 => 7.3.0
vitest: ^4.0.16 => 4.0.16Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurepending triage