traceurified-mocha
Provides a convenient way to hook traceurified into Mocha, so that you can write your tests in ES6.
Usage
First, install this module into your project.
npm install traceurified-mocha --save-dev
Now you can use it as a "compiler" in your Mocha tests:
mocha --compilers js:traceurified-mocha
By default traceurified-mocha will presume all code in your project is ES6, except for your node_modules directory. You can override this, see the "Customising compilation" section below.
Customising compilation
Create a file in the root of your project with the filename traceurified-mocha-filter.js
. Export a function that accepts a filename parameter and returns a boolean. This function will be called for each file that is require()'d during your Mocha test execution. If the function returns true, the file is treated as ES6 and compiled by Traceurified.
e.g
module.exports = function(filename) {
// Only treat files that end with .es6.js as ES6 code, and all files in the "foo" dependency.
return filename.endsWith(".es6.js") || /node_modules\/foo/.test(filename);
}
License
TODO.