const env = process.env.NODE_ENV || 'production';
const plugins = env === 'test' ? ['istanbul'] : [];

module.exports = {
  presets: [['@babel/env', { targets: { node: 6 } }]],
  plugins,
};

module.exports = api => ({
  presets: [['@babel/env', { targets: { node: 6 } }]],
  plugins: api.env() === 'test' ? ['istanbul'] : [],
});

Make better use of babelrc.js