问题描述
所以我一直在尝试配置 jest 基本测试很长时间,但没有成功。我无法导入任何 React 模块或函数。
我的 jest.config.js:
module.exports ={
moduleNameMapper: {
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js','^meteor/(.*)': '<rootDir>/__mocks__/meteorMocks.js'
},transform: {
'^.+\\.js?$': 'babel-jest'
},transformIgnorePatterns: ['node_modules/(?!@foobar)/'],modulePaths:['<rootDir>/ui']
};
babel.config.json:
{
"plugins": ["@babel/plugin-proposal-class-properties","@babel/transform-runtime","@babel/plugin-proposal-optional-chaining",["@babel/plugin-proposal-decorators",{ "legacy": true }]
],"presets": [
"@babel/preset-react","@babel/preset-env"
]
}
错误: 无法从“ui/components/elements/collections/TablePagination.js”中找到模块“/ui/components/SimpleLoading”
Require stack:
ui/components/elements/collections/TablePagination.js
ui/components/elements/ChatWidget.js
ui/components/ElementRenderer.js
8 |
9 | // import { composeCollectionFields } from '/ui/components/collectionEditor/utils';
> 10 | import Loading from '/ui/components/SimpleLoading';
我知道这个问题出现了很多次,但似乎没有一个能帮我解决。感谢您的帮助。谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)