Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.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/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
Javascript 如何打印酶的内容';s浅包装_Javascript_Reactjs_Enzyme - Fatal编程技术网

Javascript 如何打印酶的内容';s浅包装

Javascript 如何打印酶的内容';s浅包装,javascript,reactjs,enzyme,Javascript,Reactjs,Enzyme,我有以下资料: 从“酶”导入{shall} 常量包装器=浅()可用于获取表示包装器元素的字符串,如: import {shallow} from "enzyme"; const wrapper = shallow(<SampleComponent/>); console.log(wrapper.debug()); 从“酶”导入{shall}; 常量包装器=浅(); log(wrapper.debug()); 从“酶”导入{shall}; 常量包装器=浅(); log(wrappe

我有以下资料:

从“酶”导入{shall}
常量包装器=浅()可用于获取表示包装器元素的字符串,如:

import {shallow} from "enzyme";
const wrapper = shallow(<SampleComponent/>);
console.log(wrapper.debug());
从“酶”导入{shall};
常量包装器=浅();
log(wrapper.debug());
从“酶”导入{shall};
常量包装器=浅();
log(wrapper.html());

这改变了我的生活。如果控制台没有显示任何内容,我该怎么办?@kafinsalim这表明包装器的子项可能为空或类似。在这种情况下,
.debug({verbose:true})
也没有帮助。尝试如下操作:
console.log(wrapper.length)
后跟
console.log(wrapper.get(0))
import {shallow} from "enzyme";
const wrapper = shallow(<SampleComponent/>);
console.log(wrapper.html());