-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
In a monorepo with a simple SvelteKit app, running coverage with @vitest/coverage-istanbul
does not work. Tests pass but collecting coverage fails with the following error:
SyntaxError: /Users/ernest/Projects/Repros/vitest-workspaces-istanbul/packages/web/src/routes/+page.svelte: Support for the experimental syntax 'jsx' isn't currently enabled (1:1):
> 1 | <h1>Welcome to SvelteKit</h1>
| ^
2 | <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
3 |
Add @babel/preset-react (https://github.com/babel/babel/tree/main/packages/babel-preset-react) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx) to the 'plugins' section to enable parsing.
If you already added the plugin for this syntax to your config, it's possible that your config isn't being loaded.
You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded configuration:
npx cross-env BABEL_SHOW_CONFIG_FOR=/Users/ernest/Projects/Repros/vitest-workspaces-istanbul/packages/web/src/routes/+page.svelte <your build command>
See https://babeljs.io/docs/configuration#print-effective-configs for more info.
1 | <h1>Welcome to SvelteKit</h1>
| ^
2 | <p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
3 |
Works fine with @vitest/coverage-v8
but I need istanbul (required by @cloudflare/vitest-pool/workers
)
Reproduction
- Clone repo
- Install dependencies (
bun install
) - Run test script (
bun run test
) - everything passes - Run coverage script (
bun run coverage
)
System Info
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1
Memory: 40.45 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.2 - ~/Library/Caches/fnm_multishells/86163_1717766938803/bin/node
npm: 10.5.0 - ~/Library/Caches/fnm_multishells/86163_1717766938803/bin/npm
pnpm: 8.9.0 - ~/Library/pnpm/pnpm
bun: 1.1.12 - ~/.bun/bin/bun
Browsers:
Chrome: 125.0.6422.77
Edge: 125.0.2535.92
Safari: 17.5
npmPackages:
@vitest/coverage-istanbul: 1.5.0 => 1.5.0
vitest: 1.5.0 => 1.5.0
Used 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.
gterras
Metadata
Metadata
Assignees
Labels
feat: coverageIssues and PRs related to the coverage featureIssues and PRs related to the coverage featurep3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)