title: testing a throw with mocha and chai is not working for me
body: <p>I'm  using  <a href="https://www.chaijs.com/api/bdd/" rel="nofollow noreferrer">https://www.chaijs.com/api/bdd/</a>  as a resource.
  My objective is to test that the  subtraction function in subtraction.js throws an error if it's called with anything other than numbers.</p>
  <p>I also have to check for subtraction's specific error message.</p>
  <p>I'm having problems with this line of code :</p>
  <pre><code>  expect(subtraction(1, '2')).to.throw(TypeError, 'subtraction only works with numbers!');
  </code></pre>
  <p>from the context shown below:</p>
  <pre><code>var expect = require('chai').expect
  
  describe('subtraction', function () {
    var subtraction = require('../WHEREVER')  
    it('only works with numbers', function () {
  
      expect(subtraction(1, '2')).to.throw(TypeError, 'subtraction only works with numbers!');
    })
  })
  </code></pre>
  <p>given substraction.js  is:</p>
  <pre><code>function subtraction (number1, number2) {
    if (typeof number1 !== 'number' || typeof number2 !== 'number') {
      throw Error('subtraction only works with numbers!')
    }
    return number1 - number2
  }
  </code></pre>
  <p>///////////</p>
  <p>ANOTHER ATTEMPT:</p>
  <pre><code>
  var expect = require('chai').expect
  
  describe('subtraction', function () {
    var subtraction = require('../WHEREVER')  
    it('only works with numbers', function () {
    
     try { 
          subtraction(1,'2');
    }
    catch(err) {
        expect(err).to.equal('subtraction only works with numbers!');
  
  
    })
  }
  </code></pre>