jest-dom icon indicating copy to clipboard operation
jest-dom copied to clipboard

Typing problems

Open mailok opened this issue 5 years ago • 2 comments

Hi, i am having some typing issues

  • @testing-library/jest-dom version:
  • node version: 12.14.1
  • npm (or yarn) version: 6.13.4
  • WebStorm 2020.1.1
  • Next 9.3.5

Relevant code or config:

I am trying to use the toHaveTextContent function. If I run the test it works correctly, but at the typing level it keeps telling me that there are problems

tag

What confuses me is that the types exist, but he is not taking them.

types

What you did:

Here I show you my settings:

babel config

jest config

jest setup

package

{
  "compilerOptions": {
    "target": "es5",
    "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"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    "jest.setup.ts"
  ],
  "typeRoots": [
    "node_modules/@types"
  ]
}

Problem description:

any suggestion?

mailok avatar May 07 '20 13:05 mailok

Can you provide a minimal repo where this can be reproduced?

gnapse avatar May 07 '20 17:05 gnapse

In your jest-setup.ts file, did you try to just put:

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

ghostd avatar May 29 '20 19:05 ghostd