当我运行Jest测试时,大约有80%的测试由于
而失败cannot find resolver for: <config.name>
at getResolver (../node_modules/jest-runner/build/testWorker.js:153:11)
我尝试使用参数runInBand
运行测试,但似乎工作得很好,问题是当我尝试使用默认的多线程运行测试时。
jest.config
弄坏了东西吗?最佳版本-24.8.0
module.exports = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
'/node_modules/',
'<rootDir>/src/utils/'
],
coverageReporters: [
'json',
'html',
'text',
'lcov'
],
coverageThreshold: {
'global': {
'branches': 35,
'functions': 41,
'lines': 55,
'statements': 53
}
},
globals: {
_: require('lodash')
},
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/../src/utils/__mocks__//fileMock.js',
'\\.(css|less|jsf)$': '<rootDir>/../src/utils/__mocks__/styleMock.js',
'(flags|devices)$': '<rootDir>/../src/utils/__mocks__/styleMock.js'
},
roots: [
'../'
],
setupFiles: [
'<rootDir>/jest.init.js'
],
snapshotSerializers: ['enzyme-to-json/serializer'],
testEnvironment: 'node',
testMatch: [
'**/__tests__/**/*.spec.js?(x)',
'**/?(*.)+(spec|test).js?(x)'
],
testPathIgnorePatterns: [
'/node_modules/',
'/test/'
],
transformIgnorePatterns: [
'/node_modules/(?!webapps-frontend-components).+(js|jsx)$'
]
}
import 'babel-polyfill'
import React from 'react'
import Enzyme, { shallow, render, mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'
Enzyme.configure({ adapter: new Adapter() })
global.React = React
global.shallow = shallow
global.render = render
global.mount = mount