title: AssertionError: expected {} to be a function
body: <p>I'm getting a strange error while using Mocha with Chai for the first time. The only framework I've used before is Jasmine, if that should help you figure out what I'm doing wrong.</p>
  
  <p>I'm simply trying to make sure my constructor doesn't throw an error. I've been able to reduce the code to this, still getting the error:</p>
  
  <pre><code>class MyLib {
    constructor() {}
  }
  
  export default MyLib;
  </code></pre>
  
  <p>This is the test file:</p>
  
  <pre><code>import chai from 'chai';
  let { expect } = chai;
  
  import MyLib from '../index';
  
  describe('mylib-js', () =&gt; {
    describe('constructor', () =&gt; {
      it('should work', () =&gt; {
        expect(new MyLib()).to.not.throw();
      })
    });
  });
  </code></pre>
  
  <p>This is the output from Mocha:</p>
  
  <pre><code>d:\path\to\mylib-js&gt;mocha --require babel-core/register
  
  
    mylib-js
      constructor
        1) should work
  
  
    0 passing (23ms)
    1 failing
  
    1) mylib-js constructor should work:
       AssertionError: expected {} to be a function
        at Assertion.an (d:\path\to\mylib-js\node_modules\chai\lib\chai\core\assertions.js:169:10)
  
        at Assertion.assert (d:\path\to\mylib-js\node_modules\chai\lib\chai\utils\addChainableMethod.js:84:49)
        at Assertion.assertThrows (d:\path\to\mylib-js\node_modules\chai\lib\chai\core\assertions.js:1273:32)
        at Assertion.ctx.(anonymous function) [as throw] (d:\path\to\mylib-js\node_modules\chai\lib\chai\utils\addMethod.js:41:25)
        at Context.&lt;anonymous&gt; (test.js:10:4)
        at callFn (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:315:21)
        at Test.Runnable.run (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:308:7)
        at Runner.runTest (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:422:10)
        at C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:533:12
        at next (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:342:14)
        at C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:352:7
        at next (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:284:14)
        at Immediate._onImmediate (C:\Users\Myuser\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:320:5)
  </code></pre>
  
  <p>I have no idea where it gets <code>{}</code> from in the error output. What is it trying to tell me?</p>