Skip to content

Commit 5dd5a50

Browse files
committed
Update tsconfig and vite-env.d.ts
1 parent 3b3199c commit 5dd5a50

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

template/app/src/vite-env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
/// <reference types="vite/client" />
2+
3+
// This is needed to properly support Vitest testing with jest-dom matchers.
4+
// Types for jest-dom are not recognized automatically and Typescript complains
5+
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
6+
// Reference: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
7+
import '@testing-library/jest-dom';

template/app/tsconfig.json

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,24 @@
1111
{
1212
"compilerOptions": {
1313
"module": "esnext",
14-
// Needed because this is used as a project reference.
1514
"composite": true,
1615
"target": "esnext",
17-
// We're bundling all code in the end so this is the most appropriate option,
18-
// it's also important for autocomplete to work properly.
1916
"moduleResolution": "bundler",
20-
// JSX support
2117
"jsx": "preserve",
2218
"strict": true,
23-
// Allow default imports.
2419
"esModuleInterop": true,
25-
"lib": ["dom", "dom.iterable", "esnext"],
20+
"isolatedModules": true,
21+
"moduleDetection": "force",
22+
"lib": [
23+
"dom",
24+
"dom.iterable",
25+
"esnext"
26+
],
2627
"skipLibCheck": true,
2728
"allowJs": true,
28-
"typeRoots": [
29-
// This is needed to properly support Vitest testing with jest-dom matchers.
30-
// Types for jest-dom are not recognized automatically and Typescript complains
31-
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
32-
"node_modules/@testing-library",
33-
// Specifying type roots overrides the default behavior of looking at the
34-
// node_modules/@types folder so we had to list it explicitly.
35-
// Source 1: https://www.typescriptlang.org/tsconfig#typeRoots
36-
// Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
37-
"node_modules/@types"
38-
],
3929
"outDir": ".wasp/out/user"
4030
},
41-
"include": ["src"]
31+
"include": [
32+
"src"
33+
]
4234
}

0 commit comments

Comments
 (0)