Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.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
Javascript 当我在Jest中导入组件时,所有测试都失败_Javascript_Unit Testing_Jestjs_Enzyme - Fatal编程技术网

Javascript 当我在Jest中导入组件时,所有测试都失败

Javascript 当我在Jest中导入组件时,所有测试都失败,javascript,unit-testing,jestjs,enzyme,Javascript,Unit Testing,Jestjs,Enzyme,我正在学习如何使用Jest+酶,但我的代码无缘无故被破坏了。我的代码是这样的: describe('Testing my project', () => { test("Looking at wrapper contents", () => { const wrapper = shallow(<HomePage />); const x = true; expect(x).toBe(true);

我正在学习如何使用Jest+酶,但我的代码无缘无故被破坏了。我的代码是这样的:

describe('Testing my project', () => {

    test("Looking at wrapper contents", () => {
        const wrapper = shallow(<HomePage />);
        const x = true;
        expect(x).toBe(true);
    });
});
description('测试我的项目',()=>{
测试(“查看包装内容”,()=>{
常量包装器=浅();
常数x=真;
期望(x),期望(真);
});
});
不排队

const wrapper = shallow(<HomePage />);
const wrapper=shallow();
一切都很完美。但是当我加上那一行时,所有的测试都失败了。我知道主页组件已正确导入


为什么会这样?

你能为你的主页发布代码吗?