【发布时间】:2018-04-27 13:35:31
【问题描述】:
使用 React Native、jest 和酶,我什至无法检查浅渲染组件的值,更不用说在其上运行测试断言了。
Enzyme 和 jest 在其他测试文件中运行良好。
我的控制台中没有任何错误发生的日志输出。
import React from 'react';
import { shallow } from 'enzyme';
import { SomeComponent } from '../SomeComponent';
describe('SomeComponent', () => {
it('renders', () => {
const props = { name: 'hey' }
const shallowWrap = shallow(<SomeComponent {...props} />);
console.log(shallowWrap) // this wont even log
expect(shallowWrap).toMatchSnapshot();
});
});
【问题讨论】:
标签: javascript react-native jestjs enzyme