Mocha keeps bombing due to absolute paths
<p>I'm having a great deal of trouble using Enzyme and Mocha to test my React project. I have a test like this:</p>

<pre><code>import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';

import { ChipInput} from '../client/components/Chips';

describe('&lt;ChipInput /&gt;', _ =&gt; {
  it('rocks', done =&gt; {
    done();
  });
});
</code></pre>

<p>And when <code>ChipInput</code> gets imported, that file imports something with an absolute path, e.g. <code>/lib/collections/tags</code>, and then Mocha errors out because it apparently only does relative paths. How do I get this working?</p>

<p>EDIT:</p>

<p>The actual error:</p>

<pre><code>Error: Cannot find module '/lib/collections/tags'
</code></pre>

<p>This happens because <code>/tests/ChipInput-test.js</code> imports the <code>ChipInput</code> component from <code>/client/components/Chips/index.js</code>, which has the following lines:</p>

<pre><code>import React from 'react';
import {
  MapsLocalOffer as TagIcon,
  ImageRemoveRedEye as InsightIcon,
  EditorInsertChart as TestIcon,
  SocialPerson as UserIcon,
} from 'material-ui/svg-icons';

import { Tag } from '/lib/collections/tags'; // error thrown here
import { Insight } from '/lib/collections/insights';
// import { Test } from '/lib/collections/tests';
import Chip from './Chip';
import ChipDisplay from './ChipDisplay';
import ChipInput from './ChipInput';
import * as chipTypes from './chip-types';
</code></pre>