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

Typecheck not performed if there are no test-d files #5868

Open
6 tasks done
cyyynthia opened this issue Jun 10, 2024 · 2 comments
Open
6 tasks done

Typecheck not performed if there are no test-d files #5868

cyyynthia opened this issue Jun 10, 2024 · 2 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@cyyynthia
Copy link

Describe the bug

Based on the checked "Allow running vitest typecheck even, if there are no potential tests (vitest still shows source errors)" in #2107, I'd assume vitest can act as a typechecker, even in the absence of explicit type tests.

However it appears Vitest does not perform typechecks if there are no typecheck tests detected. I was hoping to rely on Vitest for typechecking as there may be tests added later on, and just let it do "basic" typechecking for the time being but it seems this is currently not supported (requires at least dummy test case).

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-wbddaw

Observe the lack of type error reported. If a file named a.test-d.ts is created, type errors will start being reported.

System Info

System:
    OS: Linux 6.9 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 7.10 GB / 15.58 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.1.0 - ~/.nvm/versions/node/v22.1.0/bin/node
    Yarn: 1.22.22 - /bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v22.1.0/bin/npm
    pnpm: 9.0.4 - /bin/pnpm
    bun: 1.1.10 - /bin/bun
  Browsers:
    Chromium: 125.0.6422.112
  npmPackages:
    @vitejs/plugin-vue: ^5.0.5 => 5.0.5 
    @vitest/coverage-v8: ^1.6.0 => 1.6.0 
    @vitest/ui: ^1.6.0 => 1.6.0 
    vite: ^5.2.12 => 5.2.12 
    vitest: ^1.6.0 => 1.6.0

Used Package Manager

yarn

Validations

@sheremet-va sheremet-va added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Jun 10, 2024
@syi0808
Copy link
Contributor

syi0808 commented Jul 15, 2024

I think there might be someone who doesn't want the type check of the source code as well, because maybe it's the performance. So I think this is the expected action but is it better to support this?

@sheremet-va
Copy link
Member

I think there might be someone who doesn't want the type check of the source code as well, because maybe it's the performance. So I think this is the expected action but is it better to support this?

If they don't have type tests and don't want to run typechecker on their source code, then they simply shouldn't use --typecheck flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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