60

I have the following :

import {shallow} from "enzyme" 

const wrapper = shallow(<SampleComponent/>);

how do I see the contents of wrapper?

Samjunior
  • 713
  • 1
  • 5
  • 14

2 Answers2

113

You can use wrapper.debug() to get a string representing the wrapper element, like in:

import {shallow} from "enzyme";
const wrapper = shallow(<SampleComponent/>);
console.log(wrapper.debug());
Guilherme Lemmi
  • 3,271
  • 7
  • 30
  • 30
12
import {shallow} from "enzyme";
const wrapper = shallow(<SampleComponent/>);
console.log(wrapper.html());
sam
  • 3,441
  • 2
  • 33
  • 42