Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs CI中的测试用例失败_Reactjs_React Native_Npm_Enzyme - Fatal编程技术网

Reactjs CI中的测试用例失败

Reactjs CI中的测试用例失败,reactjs,react-native,npm,enzyme,Reactjs,React Native,Npm,Enzyme,错误:expect(value).toMatchSnapshot() 接收到的值与存储的快照不匹配 - Snapshot + Received @@ -1,7 +1,6 @@ (48 more lines...) 在CI上运行时出现的上述错误 但在本地,所有测试用例都通过了 Junit解析器在这里用作CI系统 下面的代码是我的测试用例 import React from 'react'; import { shallow } from 'enzyme'; import { CyberHis

错误:expect(value).toMatchSnapshot()

接收到的值与存储的快照不匹配

- Snapshot

+ Received

@@ -1,7 +1,6 @@
(48 more lines...)
CI
上运行时出现的上述错误

但在本地,所有测试用例都通过了

Junit解析器在这里用作CI系统

下面的代码是我的测试用例

import React from 'react';
import { shallow } from 'enzyme';
import { CyberHistogram } from '../../../../components/dashboard/cyberHistogram';
import {
  mockThreats,
  mockKeys,
} from '../../../testConstants';

describe('CyberHistogram', () => {
  it('canary', () => {
    expect(true).toBe(true);
  });
  it('matches snapshot', () => {
    expect(shallow(
      <CyberHistogram
        threatData={mockThreats}
        keys={mockKeys}
      />,
    )).toMatchSnapshot();
  });
});
从“React”导入React;
从“酶”导入{shall};
从“../../../../components/dashboard/CyberHistogram”导入{CyberHistogram};
进口{
嘲弄威胁,,
模拟钥匙,
}来自“../../../testConstants”;
描述('CyberHistogram',()=>{
它('金丝雀',()=>{
期望(真),期望(真);
});
它('匹配快照',()=>{
期望(浅)(
,
)).toMatchSnapshot();
});
});

在当前状态下,此问题应关闭,因为它无法实际回答。我们不知道您的测试看起来如何,也不知道您使用的是什么CI系统。您能为要回答的问题添加更多详细信息吗?请不要将这些详细信息添加为评论,而是编辑您的问题。