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

Vitest v2 coverage is reporting 'Unexpected reserved word' error #6161

Closed
6 tasks done
meteorlxy opened this issue Jul 18, 2024 · 4 comments · Fixed by #6189
Closed
6 tasks done

Vitest v2 coverage is reporting 'Unexpected reserved word' error #6161

meteorlxy opened this issue Jul 18, 2024 · 4 comments · Fixed by #6189
Labels
feat: coverage Issues and PRs related to the coverage feature p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@meteorlxy
Copy link

Describe the bug

  • vitest run works well
  • vitest run --coverage fails
image

Reproduction

Repository: https://github.com/mdit-vue/mdit-vue
CI log: https://github.com/mdit-vue/mdit-vue/actions/runs/9992201242/job/27616645356

System Info

System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 334.61 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/Library/Caches/fnm_multishells/77642_1721308212385/bin/node
    npm: 10.5.0 - ~/Library/Caches/fnm_multishells/77642_1721308212385/bin/npm
    pnpm: 9.5.0 - ~/Library/Caches/fnm_multishells/77642_1721308212385/bin/pnpm
    Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 126.0.6478.182
    Safari: 17.4
  npmPackages:
    @vitest/coverage-istanbul: ^2.0.3 => 2.0.3 
    vitest: ^2.0.3 => 2.0.3

Used Package Manager

pnpm

Validations

@AriPerkkio AriPerkkio added feat: coverage Issues and PRs related to the coverage feature p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jul 19, 2024
@AriPerkkio
Copy link
Member

Renaming the index.d.cts to *.d.mts or *.d.ts seems to fix the issue 🤔

@AriPerkkio
Copy link
Member

Need to check if Vite transforms *.cts as Typescript files. Or if Vite supports *.cts at all as it's not ESM.

@sheremet-va
Copy link
Member

Need to check if Vite transforms *.cts as Typescript files. Or if Vite supports *.cts at all as it's not ESM.

Vite doesn't support transforming cts files: #3987

@AriPerkkio
Copy link
Member

As fix let's exclude *.cts from coverage completely.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: coverage Issues and PRs related to the coverage feature p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants