title: Testing JS exceptions with Mocha/Chai
body: <p>Trying to test some code that throws an exception with Mocha/Chai, but having no luck, here's the simple code I'm trying to test:</p>
  
  <pre><code>class window.VisualizationsManager
  
    test: -&gt;
      throw(new Error 'Oh no')
  </code></pre>
  
  <p>Here is my test:</p>
  
  <pre><code>describe 'VisualizationsManager', -&gt;
  
    it 'does not permit the construction of new instances', -&gt;
  
      manager = new window.VisualizationsManager
  
      chai.expect(manager.test()).to.throw('Oh no')
  </code></pre>
  
  <p>However, when I run the spec, the test fails and throws the exception.</p>
  
  <pre><code>Failure/Error: Oh no
  </code></pre>
  
  <p>what am I doing wrong here?</p>