Migration to v6 broke the tsc command
mickael-h opened this issue · comments
@testing-library/jest-dom
version: 6.1.3node
version: 18.0.0jest
(orvitest
) version: 29.6.2npm
(oryarn
) version: 9.5.1
react-testing-library
version: 14.0.0
Relevant code or config:
tsconfig.json (for NextJS project):
{
"compilerOptions": {
"target": "ES2020",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"sourceMap": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "stories"]
}
What you did:
We updated jest-dom to v6 from v5.
Then we run tsc --pretty --noEmit
.
What happened:
All test statements were no longer recognized:
I really don't have the time to make a new repo with minimal repro steps, but I hope the information I gave will suffice.
FWIW:
I had a similar issue and I had to add the include vitest/globals
as part of the compilerOptions.types
.
Here's my tsconfig.json
.
{
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "src",
"types": [
"vitest/globals",
"vite/client",
"node",
"@testing-library/jest-dom"
]
},
"include": ["src"]
}
Hope it's helpful :)