Mock dependencies with Mocha and Typescript
<p>I have a typescript project which uses mocha. Let's say we have two modules as follows.</p>

<pre><code>// http.ts
export class Http {
}

// app.ts
import Http from './http';

export class App {

}
</code></pre>

<p>How could I <strong>mock the Http module when I'm testing the App?</strong></p>

<p>The test is executed through the npm script as below.</p>

<pre><code>"test": "cross-env NODE_ENV=test ./node_modules/mocha/bin/mocha",
</code></pre>

<p>And the mocha options (mocha.opts) looks like below.</p>

<pre><code>test/setup.ts
--compilers ts:ts-node/register
--compilers tsx:ts-node/register
./src/**/*.spec.ts
</code></pre>