在React-Native项目中开玩笑。如何列出或删除重复的模块?

时间:2017-10-10 10:03:16

标签: react-native jest lerna

我正在尝试使用lerna设置jest项目。当我尝试运行 The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these: * `/Users/kevin.amiranoff/project/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) * `/Users/kevin.amiranoff/project/packages/App/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) * `/Users/kevin.amiranoff/project/packages/App-exceptions/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) * `/Users/kevin.amiranoff/project/packages/App-signin/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) * `/Users/kevin.amiranoff/project/packages/App-ui/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) * `/Users/kevin.amiranoff/project/packages/App-utils/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module) 时,我面临以下错误。

jest

以下是我的根package.json

中的"jest": { "preset": "react-native", "globals": { "__DEV__": true }, "testRegex": "packages/(.*)/src/(.*)/__tests__/(.*).js?$", "transformIgnorePatterns": [ "packages/(.*)/node_modules/?!(react|react-native)" ], "testEnvironment": "node" } 配置
@media (min-width: 768px) {
    /* disable dropping down on mouse click */
    ul.nav li.open > ul.dropdown-menu {
        display: none;    
    }
    /* enable dropping down on mouse hover */
    ul.nav li.dropdown:hover > ul.dropdown-menu {
        display: block;    
    }
}

任何人都可以向我解释一下,我必须忽略什么,以及如何?

1 个答案:

答案 0 :(得分:4)

您应该使用modulePathIgnorePatterns忽略某些目录。 确保只有您真正想要使用的那个不在此忽略列表中。

文档链接: https://facebook.github.io/jest/docs/en/configuration.html#modulepathignorepatterns-array-string