我有一系列在本地通过的快照测试。但在 Jenkins 上,我的组件似乎正在渲染不同的快照。我的测试是:
import { render } from 'enzyme';
import React from 'react';
import Wizard from '../index';
describe('Wizard', () => {
describe('Snapshot tests', () => {
it('Should render the Wizard', () => {
const container = render(<Wizard />);
expect(container).toMatchSnapshot();
});
});
});
Run Code Online (Sandbox Code Playgroud)
我的组件:
const Wizard = (): JSX.Element => (
<FTWizard
tree={root}
layouts={{
layout1: Layout1,
layout2: Layout2,
layout3: Layout3,
}}
stepsContent={{
layout1: Layout1Content,
layout2: Layout2Content,
layout3: Layout3Content,
}}
/>
);
export default Wizard;
Run Code Online (Sandbox Code Playgroud)
我正在使用酶生成快照,我的组件正在使用 xstate 机器。在本地测试时一切正常,但在 Jenkins 上我收到以下错误:
Stacktrace
Error: …Run Code Online (Sandbox Code Playgroud)