aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ava/lib/babel-config.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ava/lib/babel-config.js')
-rw-r--r--node_modules/ava/lib/babel-config.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/node_modules/ava/lib/babel-config.js b/node_modules/ava/lib/babel-config.js
index 62e841f05..d58b700b8 100644
--- a/node_modules/ava/lib/babel-config.js
+++ b/node_modules/ava/lib/babel-config.js
@@ -6,6 +6,7 @@ const figures = require('figures');
const configManager = require('hullabaloo-config-manager');
const md5Hex = require('md5-hex');
const makeDir = require('make-dir');
+const semver = require('semver');
const colors = require('./colors');
function validate(conf) {
@@ -99,6 +100,7 @@ function build(projectDir, cacheDir, userOptions, powerAssert) {
const baseOptions = {
babelrc: false,
+ plugins: [],
presets: [
['@ava/transform-test-files', {powerAssert}]
]
@@ -107,6 +109,12 @@ function build(projectDir, cacheDir, userOptions, powerAssert) {
baseOptions.presets.unshift('@ava/stage-4');
}
+ // Include object rest spread support for node versions that support it
+ // natively.
+ if (userOptions === 'default' && semver.satisfies(process.versions.node, '>= 8.3.0')) {
+ baseOptions.plugins.push('babel-plugin-syntax-object-rest-spread');
+ }
+
const baseConfig = configManager.createConfig({
dir: AVA_DIR, // Presets are resolved relative to this directory
hash: md5Hex(JSON.stringify(baseOptions)),