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

Does not report TypeScript compilation errors #4295

Closed
6 tasks done
lawrence-forooghian opened this issue Oct 12, 2023 · 5 comments
Closed
6 tasks done

Does not report TypeScript compilation errors #4295

lawrence-forooghian opened this issue Oct 12, 2023 · 5 comments

Comments

@lawrence-forooghian
Copy link

lawrence-forooghian commented Oct 12, 2023

Describe the bug

A .ts test file which contains a TypeScript type error does not report any errors.

Reproduction

See this StackBlitz. Note line 5 of basic.test.ts, which contains a type error:

const foo: string = 10;

The tests run fine. I would have expected vitest to report some sort of compilation error.

System Info

As in StackBlitz.

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

Can you provide fully runnable reproduction? There is even no typecheck command in the provided stackblitz project.

@dim0627
Copy link

dim0627 commented Oct 14, 2023

@lawrence-forooghian
Copy link
Author

Can you provide fully runnable reproduction? There is even no typecheck command in the provided stackblitz project.

I am referring to the npm run test:ui command that the Stackblitz project runs when you open the web page, which reports all of the tests as passing. I am surprised that a test file that contains TypeScript errors is considered to have all of its tests passing; I would have thought that vitest would

  1. report a TypeScript compilation error
  2. not run the tests in that file
  3. report that file as in some sense "failed"

@sheremet-va
Copy link
Member

sheremet-va commented Oct 14, 2023

Running type tests is a separate command. Please, refer to documentation https://vitest.dev/guide/testing-types.html

When transforming files, Vitest uses Vite which doesn't perform any type checking.

@lawrence-forooghian
Copy link
Author

I see. Thanks for the explanation. I’ll close this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants