babel/scripts/babel-register.js
Daniel Tschinder 1dca51f8ab Enable babel for tests (#4564)
* Enable babel for tests

This enables babel for tests by using a mocha compiler
It uses the babel config from package.json
Transformed OptionsManager test to es2015 to see if it works
Removed the 5s timeout from cli tests, as the default timeout is already 10s, this should probably fix the timouts on travis that we had in babylon
Also run the cli tests on travis, they were disabled if istanbul active, but istanbul is always active on travis so we were never running this tests.

* ignore scripts directory

* only register for tests

* Set only flag correctly
2016-10-12 10:56:50 +02:00

24 lines
583 B
JavaScript

var babel = require("../package.json").babel;
var register = require("babel-register");
var path = require("path");
if (babel.plugins) {
// correct path of relative plugins
babel.plugins = babel.plugins.map(function (plugin) {
if (plugin.charAt(0) === '.') {
return plugin.replace(/^\./, path.join(__dirname, '..'));
}
return plugin;
});
}
register(babel);
register({
extensions: [".js"],
// Only js files in the test folder but not in the subfolder fixtures.
only: /packages\/.+\/test\/(?!fixtures\/).+\.js$/,
babelrc: false,
compact: true,
});