Tawfik Tn
Tawfik Tn

Reputation: 31

Jest Failed after upgrading : _jestWatcher(...).TestWatcher is not a constructor

I have been working on upgrading a NextJS projet from version 9 to 12 :

During the updates, i had to update React from 16 to 17 and Jest from 23 to 28.

My final package.Json looks like :

"next": "^12.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"devDependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.3.0",
    "@testing-library/react-hooks": "^3.2.1",

    "jest": "^28.1.0",
    "jest-environment-jsdom": "^28.1.3",

Till now everything works "almost" fine (few test failed after upgrade) with @testing-library/react V10.

When I upgraded the @testing-library/react to V13 : I got a this error :

TypeError: _jestWatcher(...).TestWatcher is not a constructor. Have been searching for this error but I did not find anything.

Does anyone face this error recently ?

Error

Upvotes: 3

Views: 995

Answers (1)

ruby_newbie
ruby_newbie

Reputation: 3285

I fixed this error by deleting ./node-modules and running the install command(yarn install in my case) again.

Upvotes: 1

Related Questions