我试图从Jest React教程运行React示例但我收到错误
? npm test
> ...
> jest
Found 1 matching tests...
FAIL __tests__\CheckboxWithLabel-test.js (0.551s)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
Run Code Online (Sandbox Code Playgroud)
我几乎直接从示例中复制了代码.package.json如下:
{
"dependencies": {
"react": "*",
"react-tools": "*"
},
"scripts":{
"test": "jest"
},
"jest": {
"scriptPreprocessor": "<rootDir>/preprocessor.js",
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react"
]
},
"devDependencies": {
"jest-cli": "~0.1.17"
}
}
Run Code Online (Sandbox Code Playgroud)
有什么想法我可以做些什么来解决这些错误并成功运行示例测试?我很可能错过了一个重要的细节(或细节),但不完全确定是什么.哦,对于它的价值,我在Windows上运行它,如果这会影响到这一点.我真的想对我的反应组件进行一些测试(在那里也有一些问题,所以从基本的例子开始) - 任何帮助将不胜感激:)