Closed
Description
@testing-library/jest-dom
version: 6.1.5node
version: 18.19.0jest
(orvitest
) version: jest 29.7.0npm
(oryarn
) version: yarn 3.7.0
Relevant code or config:
part of tsconfig
"typeRoots": ["../node_modules/@types", "./node_modules/@types"],
"types": ["jest", "@testing-library/jest-dom"],
And package.json
"devDependencies": {
"@testing-library/jest-dom": "^6.1.5",
}
Also tried with adding "@types/jest": "^29.5.11"
, but no difference
What you did:
We upgraded from v5.17.0 to v6.1.5
What happened:
Get the following error
❯ yarn tsc --noEmit --skipLibCheck
error TS2688: Cannot find type definition file for '@testing-library/jest-dom'.
The file is in the program because:
Entry point of type library '@testing-library/jest-dom' specified in compilerOptions
tsconfig.json:29:23
29 "types": ["jest", "@testing-library/jest-dom"],
~~~~~~~~~~~~~~~~~~~~~~~~~~~
File is entry point of type library specified here.
Found 1 error.
Reproduction:
npx -y create-redwood-app@canary -y ~/tmp/rw-jest-dom
cd web
yarn tsc --noEmit --skipLibCheck
Problem description:
Or CI is failing, blocking more PRs getting merged.
Suggested solution:
Not a solution really, but more of a workaround.
Update tsconfig
to remove "@testing-library/jest-dom"
"typeRoots": ["../node_modules/@types", "./node_modules/@types"],
"types": ["jest"],
Now I get
❯ yarn tsc --noEmit --skipLibCheck
src/lib/formatters.test.tsx:175:42 - error TS2339: Property 'toBeChecked' does not exist on type 'JestMatchers<any>'.
175 expect(screen.getByRole('checkbox')).toBeChecked()
~~~~~~~~~~~
But if I now go into the test file and add
import '@testing-library/jest-dom'
Then all works.
But we didn't have to do that before, so why do we need to now?
Metadata
Metadata
Assignees
Labels
No labels