【发布时间】:2018-10-13 03:06:16
【问题描述】:
我编写了一个 React 应用程序并使用 jest 编写单元测试。
当我通过“jest --config=jest.config.json --watch”运行它时,我收到以下错误:
● 测试套件无法运行
TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.relative (path.js:1226:5)
我的 jest.config.json 是:
{
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"transformIgnorePatterns": [
"node_modules/(?!(react-native|my-project|redux-persist)/)"
]
}
【问题讨论】: