Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
特别是我们的代码库在很多地方都使用了下划线,我从不想模拟下划线。我知道我可以jest.unmock('underscore');在每个与下划线交互的测试中。有没有办法在全球范围内取消下划线?
jest.unmock('underscore');
您可以将其添加到 package.json。
"jest": { "scriptPreprocessor": "<rootDir>/node_modules/babel-jest", "unmockedModulePathPatterns": [ "enzyme", "react", "react-addons-test-utils" ], "verbose": true }