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
This commit is contained in:
23
scripts/babel-register.js
Normal file
23
scripts/babel-register.js
Normal file
@@ -0,0 +1,23 @@
|
||||
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,
|
||||
});
|
||||
Reference in New Issue
Block a user