How can I mock Webpack's require.context in Jest? : <p>Suppose I have the following module:</p>

<pre><code>var modulesReq = require.context('.', false, /\.js$/);
modulesReq.keys().forEach(function(module) {
  modulesReq(module);
});
</code></pre>

<p>Jest complains because it doesn't know about <code>require.context</code>:</p>

<pre><code> FAIL  /foo/bar.spec.js (0s)
● Runtime Error
  - TypeError: require.context is not a function
</code></pre>

<p>How can I mock it? I tried using <a href="http://facebook.github.io/jest/docs/api.html#setuptestframeworkscriptfile-string"><code>setupTestFrameworkScriptFile</code></a> Jest configuration but the tests can't see any changes that I've made in <code>require</code>.</p>
