title: Jest - ReferenceError: define is not defined
body: <p>I'm trying to use jest to start doing some unit testing but I've come across this error that a lot of people seem to be getting but I can't seem to figure it out.</p>
  
  <p>Here's is what I'm trying to do (and I realize requirejs isn't supported):</p>
  
  <pre><code>jest.mock("../widgets/", () =&gt; {
    return &lt;button&gt;button&lt;/button&gt;;
  });
  
  describe('TextInput', () =&gt; {
    describe('when user inputs a value', () =&gt; {
      it('calls correct function to handle change', () =&gt; {
        const handleChange = jest.fn();
        const value = "test"
        const wrapper = shallow(&lt;TextInput handleChange={handleChange} /&gt;);
        const textInputElement = wrapper.find("#textfield");
        textInputElement.simulate('change', {target: { value }})
  
        expect(handleChange).toHaveBeenCalledTimes(1);
      });
    });
  });
  
  import React from "react";
  import ReactDOM from "react-dom";
  import * as TestUtils from "react-dom/test-utils";
  import { TextInput } from "../widgets/";
  </code></pre>
  
  <p>and here is my <code>package.json</code></p>
  
  <pre><code>"jest": {
      "collectCoverageFrom": [
        "src/**/*.js"
      ],
      "setupFiles": [
  
      ],
      "testMatch": [
        "**/src/**/?(*.)+(test).js"
      ],
      "testEnvironment": "node",
      "testURL": "http://localhost",
      "transform": {
        "^.+\\.(js)$": "./node_modules/babel-jest",
        "^.+\\.css$": "./config/jest/cssTransform.js",
        "^(?!.*\\.(js|jsx|mjs|css|json)$)": "./config/jest/fileTransform.js"
      },
      "transformIgnorePatterns": [
        "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
      ],
      "moduleNameMapper": {
        "^react-native$": "react-native-web"
      },
      "moduleFileExtensions": [
        "web.js",
        "js",
        "json",
        "web.jsx",
        "jsx",
        "node",
        "mjs"
      ]
   }
  </code></pre>
  
  <p>Upon running jest, I get the error <code>ReferenceError: define is not defined</code> and here is a more detailed error:
  <a href="https://i.stack.imgur.com/zwUZu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwUZu.png" alt="errorMsg"></a></p>
  
  <p>I would appreciate any help! Been pulling my hair out over this for the past few days :-(</p>