Adding ES6 Support to Tests using Mocha and Babel

Kent C. Dodds
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.

fpaxton
fpaxton
~ 5 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
Kannan
~ 2 years ago

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