Adding ES6 Support to Tests using Mocha and Babel

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

By adding ES6 support to our source code, we need to add that same support to our tests so we can consume that synatx. This is quite easy with the --compilers flag for Mocha.

Faris Paxton
~ 9 years ago

Following my comment on the previous lesson, --compilers will need js:babel-register for the test that watches. For the coverage test, babel-istanbul will need to replace istanbul without the need for --compilers.

Kannan
~ 6 years ago

for electron-Mocha i tried its not instrumenting i still see 0 coverage in the report, for Mocha yes it works fine