title: React & Enzyme: why isn't beforeEach() working?
body: <p>I'm writing my first React tests and running into an issue where my <code>beforeEach</code> statement isn't working. Here's my test file:</p>
  
  <pre><code>import React from 'react';
  import { shallow } from 'enzyme';
  import Home from '../components/Home';
  import IntroText from '../components/IntroText';
  import Form from '../components/Form';
  
  describe('&lt;Home /&gt;', () =&gt; {
    beforeEach(() =&gt; {
      const wrapper = shallow(&lt;Home /&gt;);
    });
  
    it('renders the IntroText component', () =&gt; {
      expect(wrapper.find(IntroText).length).toBe(1);
    });
  
    it('renders the Form component', () =&gt; {
      expect(wrapper.find(Form).length).toBe(1);
    });
  });
  </code></pre>
  
  <p>Here's the relevant part of my <code>package.json</code>:</p>
  
  <pre><code>"devDependencies": {
    "babel-jest": "^18.0.0",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.23.0",
    "jest": "^18.1.0",
    "react-scripts": "0.9.0",
    "react-test-renderer": "^15.4.2"
   },
  "dependencies": {
    "enzyme": "^2.7.1",
    "jest-enzyme": "^2.1.2",
    "react": "^15.4.2",
    "react-addons-test-utils": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-router": "^3.0.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
  </code></pre>
  
  <p>I get this error when the tests run:</p>
  
  <pre><code>ReferenceError: wrapper is not defined
  </code></pre>
  
  <p>What am I missing?</p>