我有这样的快照测试:
it('should render correctly', () => {
expect(shallow(<PaperStyle/>)).toMatchSnapshot();
});
纸张在哪里:
import Paper from '@material-ui/core/Paper'
export const PaperStyle = styled(Paper)`
padding: 20px;
`
在本地生成快照时,我得到:
...
"render": [Function],
},
"displayName": "WithStyles(ForwardRef(Paper))",
"options": Object {
"defaultTheme": Object {
...
但是在部署中运行'yarn test(yarn test:ci)'时,添加了defaultProps: undefined
,使快照在部署期间失败:
package.json
"test": "react-scripts test --watchAll=false",
"test:ci": "react-scripts test --watchAll=false --testResultsProcessor=jest-junit",