title: jest snapshot: ReferenceError: React is not defined
body: <p>I am using Jest to test, falling in love with <a href="http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest" rel="nofollow noreferrer">snapshot</a>. </p>
  
  <p>I am not importing React in my components because I provide it by webpack when I bundle the code, but when I run the test webpack is not envolved and when I get an:</p>
  
  <p><strong>the error:</strong></p>
  
  <pre><code>ReferenceError: React is not defined
  
    at Object.&lt;anonymous&gt; (src/components/breadcrumb/Breadcrumb.jsx:22:35)
    at Object.&lt;anonymous&gt; (test/components/components.test.js:3:19)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  </code></pre>
  
  <p><strong>the webpack:</strong></p>
  
  <pre><code>new webpack.ProvidePlugin({
      React: 'react'
  })
  </code></pre>
  
  <p><strong>the test:</strong></p>
  
  <pre><code>import React from 'react';
  import Breadcrumb from '../../src/components/breadcrumb/Breadcrumb';
  import renderer from 'react-test-renderer';
  
  describe.only('Components ', () =&gt; {
      test('Breadcrumb.jsx', () =&gt; {
          const tree = renderer.create(
              &lt;Breadcrumb path={['uno', 'due']} /&gt;
          ).toJSON();
  
          expect(tree).toMatchSnapshot();
      });
  });
  </code></pre>
  
  <p><strong>the component:</strong> </p>
  
  <pre><code>import PropTypes from 'prop-types';
  
  import I18n from '../../decorators/I18n';
  @I18n
  class Breadcrumb extends React.Component {
  
      static propTypes = {
          path: PropTypes.array.isRequired
      }
  
      getBreadcrumb = () =&gt; {
          return this.props.path.map((el, key) =&gt; {
              return (
                  &lt;span key={key}&gt;{el}&lt;/span&gt;
              );
          });
      }
  
      render() {
          return &lt;div&gt;{this.getBreadcrumb()}&lt;/div&gt;;
      }
  }
  
  export default Breadcrumb;
  </code></pre>
  
  <p>Would you please help me with some kind of example? 
  I have seen there is something around about those kind of issues, but finally I couldnt find (or undestand) the solutions.</p>