You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I found out with my SvelteKit 5 project, we need to add `"types": ["@testing-library/jest-dom"]` to the `compilerOptions` in the project's `tsconfig.json`. Otherwise my VSCode complains that it can't find e.g. `toBeInTheDocument` (Property 'toBeInTheDocument' does not exist on type 'Assertion<HTMLElement>'.ts(2339)).
I'm no TypeScript Pro, so feel free to reword what I wrote. :-)
If you use TypeScript and want to use [`@testing-library/jest-dom`][@testing-library/jest-dom] you need to tell the TypeScript compiler about [`@testing-library/jest-dom`][@testing-library/jest-dom] by adding it in your `tsconfig.json` to the `compilerOptions`.
144
+
145
+
```json title="package.json"
146
+
{
147
+
"compilerOptions": {
148
+
"types": ["@testing-library/jest-dom"],
149
+
}
150
+
}
151
+
```
152
+
141
153
## Jest
142
154
143
155
[`@testing-library/svelte`][@testing-library/svelte] is ESM-only, which means
0 commit comments