owser environments. To work around this you can use the browser mocks that ship with the mithril npm package.</p>
<p>The simplest way to do this is ensure the following snippet of code runs <strong>before</strong> you include mithril itself in your project.</p>
<pre><code class="language-js">// Polyfill 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;mit