8得票1回答
通过名称在 Jest Enzyme 中查找组件元素

组件: <input name="search" onChange={this.onChange}> console.log(component.find('div').at(0).childAt(0).find('input').find('search').debug())...

20得票2回答
在转换选项中找不到模块<rootDir>/node_modules/vue-jest。

我遇到了一个错误,需要你的帮助。感谢查看这个问题。我的情况是:我正在为我的项目配置Drone CI工具,并且在运行drone.yml上的单元测试时遇到了这个问题。Validation Error: Module &lt;rootDir&gt;/node_modules/vue-jest ...

7得票2回答
React Native中使用Jest遇到问题

在尝试运行测试用例代码时,我遇到了错误。我正在使用React Native和Jest。升级到0.40版本之前一切正常。现在是版本0.42,我的所有测试用例都停止工作,并出现以下错误。 ({"Object.&lt;anonymous&gt;":function(module,exports,r...

32得票4回答
React Jest导致“SyntaxError: Unexpected token .”

我现在正在使用React Jest测试代码。如果一个组件是单独的,并且没有导入任何其他内容,则“npm test”会顺利运行。现在我想一起测试多个组件,但立即出现以下错误: SyntaxError: Unexpected token . 似乎每当React导入其他内容时,如这个:requi...

8得票2回答
Jest - 在React组件中模拟箭头函数

以下是我的组件和测试代码,为什么我运行测试时confirmClickHandler方法仍然被调用? 注意:我发现当我将该方法从箭头函数更改为普通函数时,它可以被正确模拟。我错过了什么吗? class CalendarConfirmation extends React.Component ...

38得票4回答
升级到26.x后,Jest配置抛出了"type ErrorHandler =(error:mixed,isFatal:boolean)=> void"的错误信息。

我不知道为什么突然间这个东西不工作了,但这是我的jest.config.js文件: module.exports = { preset: 'react-native', verbose: true, moduleFileExtensions: ['ts', 'tsx', 'js'...

7得票1回答
如何在NX项目中使用ES6来处理node_modules及使用jest?

我有一个包含应用和库的NX结构项目。我正在为React + TypeScript库编写测试。当我尝试使用suneditor + suneditor-react时,遇到了问题: Jest encountered an unexpected token Jest failed to p...

11得票2回答
Jest失败:在React 16升级后,从'ReactShallowRenderer.js'找不到模块'react/lib/React'

我刚刚从v15.6.2升级到react v16.0.0(通过变基) 问题 运行我的jest测试会出现以下错误 ● Test suite failed to run Cannot find module 'react/lib/React' from 'ReactShallow...

23得票4回答
Babel@7和Jest配置

也许你可以帮助我吗? 我想要配置jest来使用babel@7 所以现在有以下内容: "jest": "^23.4.1", "@babel/core": "^7.0.0-beta.54", "babel-7-jest": "^21.3.3", "babel-jest": "^20.0.3", ...

12得票2回答
使用jest + vuejs + vuetify时出现意外的标识符错误。

我已经四处寻找答案了。我怀疑这是一个.babelrc的问题,但我找不到可行的解决方法。 应用程序运行得非常好,但我发现,Jest和Rollup确实依赖于.babelrc。另一个可能的罪魁祸首是Leaflet。在所有我构建和测试的组件中,只有包含Leaflet和vue2-leaflet的一个似...