How to test code that is using whatwg-fetch with mocha?
<p>I'm using <a href="https://github.com/github/fetch" rel="noreferrer">https://github.com/github/fetch</a> in my app, which works fine but I would like to test my code with Mocha and babel since I'm writing ES2016.</p>

<p>This does not work out of the box. I'm getting: </p>

<pre><code>1) testApi.js Test api error handling:
 ReferenceError: fetch is not defined
  at callApi (callApi.js:10:10)
  at Context.&lt;anonymous&gt; (testApi.js:8:40)
</code></pre>

<p>Because well, fetch is not defined. When I build for the browser fetch is exposed by webpack. </p>

<p>I've tried using <a href="https://github.com/bitinn/node-fetch" rel="noreferrer">https://github.com/bitinn/node-fetch</a> but the api is slightly different and wants full url's instead of relative paths for example. </p>

<p>Is there a solution to this problem?</p>