title: React test with jest does not honor moduleNameMapper from webpack aliases
body: <p>I am using jest and enzyme to test my react component. I am also using blueprint icons as one of the dependency in my react component.  As part of my webpack config, following is added:</p>
  
  <pre><code>config.resolve.alias = {
      blueprintIcons: path.resolve('./node_modules/@blueprintjs/icons'),
      blueprint: path.resolve('./node_modules/@blueprintjs/core')
  };
  </code></pre>
  
  <p>Following is added as part of jest config:</p>
  
  <pre><code>    rootDir: '.',
      roots: [
          '&lt;rootDir&gt;/__test__/'
      ],
      transformIgnorePatterns: [
          '&lt;rootDir&gt;/node_modules/'
      ],
      transform: {
          '^.+\\.jsx?$': 'babel-jest'
      },
      testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$',
      moduleDirectories: ['node_modules'],
      moduleFileExtensions: [
          'js',
          'jsx',
          'json',
          'node'
      ],
      moduleNameMapper: {
          '\\.(css|scss)$': 'identity-obj-proxy',
          blueprintIcons: '&lt;rootDir&gt;/node_modules/@blueprintjs/core'
          blueprint: '&lt;rootDir&gt;/node_modules/@blueprintjs/core'
      },
      snapshotSerializers: ['enzyme-to-json/serializer']
  };
  </code></pre>
  
  <p>Here is my component:</p>
  
  <pre><code>import React, { Component } from 'react';
  import Icon from 'blueprint';
  import IconNames from 'blueprintIcons';
  class Foo extends Component {
    render() {
        return (
          &lt;div&gt;
             &lt;p&gt;Hello Foo&lt;/p&gt;
             &lt;Icon icon={IconNames.HOME} iconSize={Icon.SIZE_LARGE}/&gt;
          &lt;/div&gt;
        );
    }
  }
  export default Foo;
  </code></pre>
  
  <p>Here is my foo.test.js</p>
  
  <pre><code>import React from 'react';
  import Foo from '../../src/Components/Foo';
  import Adapter from 'enzyme-adapter-react-16';
  import Enzyme, { mount, shallow } from 'enzyme';
  
  describe('Reviews component', () =&gt; {
      it('render component when loading in progress', () =&gt; {
          const mountedComponent = mount(&lt;Foo /&gt;);
      });
  });
  </code></pre>
  
  <p>When I am trying to test that component, the test fails with</p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'HOME' of undefined at IconNames.HOME</p>
  </blockquote>
  
  <p>Here are some packages specified in my package.json</p>
  
  <pre><code>"babel-cli": "6.26.0",
  "babel-core": "^6.26.3",
  "babel-eslint": "^10.0.1",
  "babel-jest": "^23.0.1",
  "babel-loader": "7.1.4",
  "enzyme": "^3.9.0",
  "enzyme-adapter-react-16": "^1.1.1",
  "enzyme-to-json": "^3.3.4",
  "jest": "^23.1.0",
  "jest-html-reporter": "^2.3.0",
  "@blueprintjs/core": "^2.3.1",
  "react": "16.2.0"
  </code></pre>
  
  <p>I am using react 16.2.0</p>
  
  <p>I tried mocking it but doesn't work(maybe I am not doing it correctly) but here is the code which I am using:</p>
  
  <pre><code>jest.mock('@blueprintjs/icons', () =&gt; (
      { IconNames: {HOME: 'home' }}));
  </code></pre>