Open KevinBurton opened 4 years ago
You need to uninstall jest
and use the version from react-scripts
.
Nick,
Not to drag this on but I get a warning that ts-jest requires jest >= 26 this is a typescript project and I am not sure how to tell ts-jest that jest is installed with react-scripts?
Kevin
On Mon, Jul 6, 2020 at 4:06 PM Nick McCurdy notifications@github.com wrote:
You need to uninstall jest and use the version from react-scripts.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kentcdodds/react-testing-library-course/issues/18#issuecomment-654465149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUFM3VDVOMDVLZWQXPBZETR2I4CLANCNFSM4ORWZ6ZA .
You don't need ts-jest
as react-scripts already supports TypeScript, so you can also uninstall that.
jest-runner-eslint? Again from the course.
On Tue, Jul 7, 2020 at 2:17 AM Nick McCurdy notifications@github.com wrote:
You don't need ts-jest, you can also uninstall that.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kentcdodds/react-testing-library-course/issues/18#issuecomment-654649700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUFM3UOC7HXLGB7DZGJ2FDR2LDZFANCNFSM4ORWZ6ZA .
You generally shouldn't need any of this tooling, it's handled by CRA (except for Prettier which you can run on your own via a script or extension if you want)
I have a CRA created app that I tried to install Jest as per the package.json in the course but when I install it an subsequently run the tests I get:
I tried the suggestions in the error list and indeed found multiple dependencies. Running 'yarn why jest' gives me:
So based on my understanding (which is limited) it seems that kcd-scripts is referencing the latest Jest and react-scripts is referencing an earlier one. It seems that I need to update react-scripts dependency but I am not sure how.
If I try just using kcd-scripts I get a number of errors in the tests but I don't see any explanation. Errors mainly about toBeInTheDocument not a function
TypeError: expect(...).toBeInTheDocument is not a function
Thank you.Kevin