I try to use expect mocha tests written in ES6, and I get a TypeError even with a simple test case:
import expect from "expect"; describe('Example', () => { it('should just work', (done) => { expect(5).to.eql(5); done(); }); });
I use Babel to convert and run tests:
./node_modules/.bin/mocha --compilers js:babel/register example.js
Result:
Example 1) should just work 0 passing (76ms) 1 failing 1) Example should just work: TypeError: Cannot read property 'eql' of undefined at Context.<anonymous> (example.js:5:17)
Is this not supported, or am I missing something critical?
Versions:
- babel 5.5.6
- expect 1.6.0
- mocha 2.2.5
javascript ecmascript-6 mocha
Collin allen
source share