Wallaby.js supports continuous testing and real-time code coverage for CoffeeScript via the built-in CoffeeScript compiler, for browser and node.js.
No special configuration is required, unless you need to change some default CoffeeScript compiler settings.
module.exports = function (w) {
return {
files: [
'src/**/*.coffee'
],
tests: [
'test/**/*Spec.coffee'
]
// CoffeeScript compiler is on by default with the default options
// You can configure the built-in compiler by passing options to it
// compilers: {
// '**/*.coffee': w.compilers.coffeeScript({})
//}
};
};
You may find the working sample of wallaby.js configuration for CoffeeScript (for both browser and node.js) in this repository.
CoffeeScript compiler version
By default, wallaby.js is using your project local CoffeeScript compiler version (from the project node_modules/coffee-script
), if there’s no local version, then wallaby falls back to the embedded CoffeeScript compiler version which is v1.10.0.
Using with Babel
Sometimes you may need to compile your code with Babel after CoffeeScript compilation. You may use wallaby preprocessor to do it:
module.exports = function (w) {
return {
files: [
...
],
tests: [
...
],
...
preprocessors: {
'**/*.js': file => require('babel-core').transform(
file.content,
{sourceMap: true, presets: ['es2015']})
}
};
};