testing-library / jest-dom

:owl: Custom jest matchers to test the state of the DOM

Home Page:https://testing-library.com/docs/ecosystem-jest-dom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig.

ethanneff opened this issue · comments

Relevant code or config:

yarn tsc

What you did:

upgrade from 5.17.0 to 6.0.1

What happened:

Got an error

Reproduction:

Got the following error

Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig.

Problem description:

Error when updating @testing-library/jest-dom

Suggested solution:

Not to error

Adding the following to jest.setup.ts did not work

import '@testing-library/jest-dom';
import '@testing-library/jest-dom/jest-globals';

The following worked

yarn add -D @types/jest

Glad you got it working.