Permalink
Browse files

Respect extension configuration in profile.js

Fixes #1819.
  • Loading branch information...
goooseman authored and novemberborn committed Sep 15, 2018
1 parent 9203448 commit 30a80b6e2fb90cdb0d7ce9a5878ea985d4ede7bd
Showing with 15 additions and 4 deletions.
  1. +15 −4 profile.js
View
@@ -11,10 +11,12 @@ const Promise = require('bluebird');
const uniqueTempDir = require('unique-temp-dir');
const arrify = require('arrify');
const resolveCwd = require('resolve-cwd');
const escapeStringRegexp = require('escape-string-regexp');
const babelPipeline = require('./lib/babel-pipeline');
const RunStatus = require('./lib/run-status');
const VerboseReporter = require('./lib/reporters/verbose');
const loadConfig = require('./lib/load-config');
const normalizeExtensions = require('./lib/extensions');
function resolveModules(modules) {
return arrify(modules).map(name => {
@@ -70,12 +72,21 @@ if (cli.input.length === 0) {
const file = path.resolve(cli.input[0]);
const cacheDir = conf.cacheEnabled === false ? uniqueTempDir() : path.join(projectDir, 'node_modules', '.cache', 'ava');
const precompileFile = babelPipeline.build(process.cwd(), cacheDir, babelPipeline.validate(conf.babel), conf.compileEnhancements === true);
const precompiled = {};
if (precompileFile) {
precompiled[file] = precompileFile(file);
const babelConfig = babelPipeline.validate(conf.babel);
conf.extensions = normalizeExtensions(conf.extensions || [], babelConfig);
const _regexpFullExtensions = new RegExp(`\\.(${conf.extensions.full.map(ext => escapeStringRegexp(ext)).join('|')})$`);
const precompileFull = babelPipeline.build(process.cwd(), cacheDir, babelConfig, conf.compileEnhancements === true);
let precompileEnhancementsOnly = () => null;
if (conf.compileEnhancements) {
precompileEnhancementsOnly = babelPipeline.build(projectDir, cacheDir, null, conf.compileEnhancements);
}
const precompiled = {};
precompiled[file] = _regexpFullExtensions.test(file) ? precompileFull(file) : precompileEnhancementsOnly(file);
const opts = {
file,
projectDir,

0 comments on commit 30a80b6

Please sign in to comment.