cossack910 / ReactJest

React Testing Library + JEST
0 stars 0 forks source link

プロパティ 'toBeInTheDocument' は型 'JestMatchers<HTMLElement>' に存在しません。 #6

Open cossack910 opened 1 year ago

cossack910 commented 1 year ago

参考 https://stackoverflow.com/questions/57861187/property-tobeinthedocument-does-not-exist-on-type-matchersany

ts.config.json ts.config.node.json に以下を追加

"types": ["node", "jest", "@testing-library/jest-dom"]

https://github.com/cossack910/ReactJest/blob/fed7b0dd662b8ecc235f8ffc9865eb038a3e3673/app/tsconfig.json#L22 https://github.com/cossack910/ReactJest/blob/fed7b0dd662b8ecc235f8ffc9865eb038a3e3673/app/tsconfig.node.json#L8

cossack910 commented 1 year ago

テストコードにimport追加

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

https://github.com/cossack910/ReactJest/blob/fed7b0dd662b8ecc235f8ffc9865eb038a3e3673/app/src/FrameworkList.test.tsx#L3