yfill DOM env for mithril
global.window = require(&quot;mithril/test-utils/browserMock.js&quot;)();
global.document = window.document;
</code></pre>
<p>Once that snippet has been run you can <code>require(&quot;mithril&quot;)</code> and it should be quite happy.</p>
<hr>
<h3 id="good-testing-practices"><a href="#good-testing-practices">Good testing practices</a></h3>
<p>Generally speaking, there are two ways to write tests: upfront and after the fact.</p>
<p>Writing tests upfront requires specifications to 