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

Missing type for test.fails when using testing library #1133

Closed
6 tasks done
charklewis opened this issue Apr 10, 2022 · 3 comments
Closed
6 tasks done

Missing type for test.fails when using testing library #1133

charklewis opened this issue Apr 10, 2022 · 3 comments

Comments

@charklewis
Copy link

charklewis commented Apr 10, 2022

Describe the bug

When I use test.fails I get the typescript error Property 'fails' does not exist on type 'It'. I can fix this by importing the vitest test, however wondering if there is a way I can have this apply without my needing to import it.

I think this is happening due to typescript linting picking up the jest version of It.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-larkt5?file=test/basic.test.ts

System Info

Used Package Manager

yarn

Validations

@charklewis charklewis changed the title Missing type for .fails Missing type for test.fails when using testing library Apr 10, 2022
@sheremet-va
Copy link
Member

I think you have jest types for "test". If so, there is nothing we can do to fix this.

@charklewis
Copy link
Author

I think you have jest types for "test". If so, there is nothing we can do to fix this.

I have't added this myself, I assume it is coming from one of the @testing-library packages. If import test from vitest then it resolves the issue, I was just hoping I wouldn't have to (like I don't with jest). If that is the only solution at the moment, feel welcome to close this issue 🙂

Thanks for the prompt reply!

@sheremet-va
Copy link
Member

Probably jest-dom testing-library/jest-dom#427

chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants