gpt4 book ai didi

react-native - 输入命令 npm test 时测试失败

转载 作者:行者123 更新时间:2023-12-05 07:20:45 26 4
gpt4 key购买 nike

我收到一个错误,该错误又返回测试失败。无法找到解决方案。已检查但未找到合适的答案

我试过以下方法:1.检查babel版本:使用7.5.52. https://github.com/GeekyAnts/NativeBase/issues/9773. https://gist.github.com/iamvery/4d4b0ef68cd1f2de81b858fe3a2d08c54. https://github.com/GeekyAnts/NativeBase/issues/2579

({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import connectStyle, { clearThemeCache } from "./src/connectStyle";

SyntaxError: Unexpected identifier

at ScriptTransformer._transformAndBuildScript (../../node_modules/@jest/transform/build/ScriptTransformer.js:471:17)
at ScriptTransformer.transform (../../node_modules/@jest/transform/build/ScriptTransformer.js:513:25)
at Object.<anonymous> (../../node_modules/native-base/src/index.js:1:1)

Test Suites: 1 failed, 1 passed, 2 total
Tests: 4 passed, 4 total
Snapshots: 1 passed, 1 total
Time: 2.022s
Ran all test suites.
npm ERR! Test failed. See above for more details.

如上所示,实际结果是测试失败

预期结果是测试应该通过

最佳答案

你可以把它添加到你的 jest 配置文件中

"transformIgnorePatterns": [ "node_modules/(?!react-native|@shoutem|react-clone-referenced-element|native-base-shoutem-theme)" ]

关于react-native - 输入命令 npm test 时测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57350938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com