How to unit test ES6 and even ES7?

  node.js, question

Koa2 frame used
Therefore, the contents of es6 and es7 will be used.
At present, mocha unit tests are used.
mocha –compilers js:babel-core/register
At run time, add this bebel compilation module, but only ES6 is suspected to be compiled?
Babel-cli is used for compilation and packaging, so how to use it in combination with mocha?
Is there another way?

Using npm to call your mocha can be compiled before testing. Json adds a few script to my package.

"test-build": "tsc -p ./src/test && cp -r ./src/test/assets ./build/test/assets",
        "pretest": "npm run test-build",
        "test": "mocha --require source-map-support/register -t 10000 --recursive build/test"

At this time, only need tonpm testJust do it. I am using TypeScript.