title: How to see what the rendered React component looks like in the Jest unit test?
body: <p>I'm trying to run a test for the React component. I need to check how it looks like after rendering. Tried to use <code>ReactDOMServer.renderToString()</code> but it fails. Here is the code:</p>
  
  <pre><code>import { NewRec } from '../src/components/edit';
  import { shallow } from 'enzyme';
  import React from 'react/lib/ReactWithAddons';
  import ReactDOMServer from 'react-dom/server';
  
  jest.mock('react-dom');
  jest.mock('react/lib/ReactDefaultInjection');
  
  describe('NewRec component', () =&gt; {
      const component = shallow(&lt;NewRec /&gt;);
      it('returns true if blah blah', ()=&gt;{
          var htmlstring = ReactDOMServer.renderToString(&lt;component /&gt;);
      });
  });
  </code></pre>
  
  <p>I'm getting the following error:</p>
  
  <pre><code>Invariant Violation: There is no registered component for the tag component
  </code></pre>
  
  <p>I tried to call it like: <code>var htmlstring = ReactDOMServer.renderToString(component);</code> then I get this error:</p>
  
  <pre><code>Invariant Violation: renderToString(): You must pass a valid ReactElement.
  </code></pre>
  
  <p>Does anyone knows where the problem is?</p>