1

I wrote a React application and used jest to write unit tests.

when I run it by "jest --config=jest.config.json --watch" I get the following error:

● Test suite failed to run

TypeError: Path must be a string. Received undefined

  at assertPath (path.js:7:11)
  at Object.relative (path.js:1226:5)

My jest.config.json is:

{
    "snapshotSerializers": [
        "enzyme-to-json/serializer"
    ],
    "transformIgnorePatterns": [
        "node_modules/(?!(react-native|my-project|redux-persist)/)"
    ]
}
skyboyer
  • 22,209
  • 7
  • 57
  • 64
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183

1 Answers1

0

Since I built my app using create-react-app, I just ran "npm test" and the tests ran successfully.

I understood that Jest is automatically included in the project, and probably adding manually jest to package.json is not effective.

CrazySynthax
  • 13,662
  • 34
  • 99
  • 183