Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jest - Cannot find module 'setupDevtools' from 'setup.js'

I am studying Jest and i am trying to add it to my component => github.com/bolket/react-native-scrollview-smart.

When i start my test i have this error:

$ jest 
 FAIL  lib/ScrollViewSmart.test.js
  ● Test suite failed to run

    Cannot find module 'setupDevtools' from 'setup.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
      at Object.<anonymous> (node_modules/react-native/jest/setup.js:30:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.492s

After many attempts i have moved the test in __DEV__ folder and the error has been resolved.

But if i run again the test, i have the error again...🤔.

Can you explain to me what is wrong?

like image 618
SaroVin Avatar asked Jul 14 '17 13:07

SaroVin


1 Answers

I think there are multiple cases that can lead to this same error. In my case, I had node_modules added to the ignore_dirs in the .watchmanconfig file, I removed it and the error disappeared. Try running jest --no-watchman to see if watchman is the origin of the problem.

like image 139
Cesar Avatar answered Oct 16 '22 19:10

Cesar