title: Watch console for errors
body: <p>I have an app using canvas elements, which are difficult to test with javascript but it does throw messages to the console.</p>
  <p>How can I watch for errors written to the console?</p>
  <p>I tried monkey patching the window console, but it's not working.</p>
  <pre class="lang-js prettyprint-override"><code>const messages = []
  
  window.console.error = (msg) =&gt; {
    messages.push(msg)
  })
  
  // actions causing error
  
  expect(messages.length).to.eq(0)
  </code></pre>