开玩笑-从'setup.js'中找不到模块'setupDevtools'

Sar*_*Vin 8 jestjs react-native

我正在研究Jest,并且尝试将其添加到我的组件=> github.com/bolket/react-native-scrollview-smart中。

当我开始测试时,出现以下错误:

$ 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
Run Code Online (Sandbox Code Playgroud)

经过多次尝试,我将测试移至__DEV__文件夹中,并且错误已解决。

但是,如果我再次运行测试,我将再次出现错误...。

你能告诉我什么地方错了吗?

小智 -1

几分钟前我遇到了同样的错误。看起来它可能位于 package.json 中的笑话配置中。看https://github.com/facebook/jest/issues/1840#issuecomment-251037030

就我而言,它有效。