我正在运行jest酶测试,带有快照。快照文件生成正确,但其内容基本为: // Jest Snapshot v1, https;//link
exports[`Component1 should match snapshot 1`] = `ReactWrapper {}`;
^^^^^^^^ <-- only component name is changing 对于每个测试文件,即使测试文件有复杂的逻辑和400+代码行。 为什么会发生这种情况?整个代码在哪里? it('should match snapshot', () => {
const
我用的是玩笑和酶。在我的eslint文件中,我在env下添加了jest作为true。但我得到了一个皮棉的浅层错误,因为我已经包括它的全球范围。错误是-错误“浅”没有定义,没有定义
setupTests.js
//as we are accessing our application with a http://localhost prefix, we need to update our jest configuration
import { shallow, render, mount, configure } from 'enzyme';
import Adapter f
我想用酶来测试我的反应--世博管理项目中的天然成分。我跟踪的文档,但现在我得到了:
Test environment found at "/Users/raarts/myproject/node_modules/jest-environment-enzyme/lib/index.js" does not export a "getVmContext" method, which is mandatory from Jest 27. This method is a replacement for "runScript".
我的猜测是,jest-e
调用enzym's mount函数有问题。上面写着:
Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none. To
configure an adapter, you should call `Enzyme.configure({ adapter: new Adapter() })`
before using any of Enzyme's top level APIs, where `Adapter` is the adapter