avajs / babel

Babel provider for AVA.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVA only loads Babel-compilation output for .js files

novemberborn opened this issue · comments

If Babel is enabled, test and helper files are pre-compiled by AVA. The output is written to a cache directory. AVA then intercepts require() calls for the files and loads the pre-compilation output instead.

However, this interception is only configured for .js files! This block needs to be executed for each configured extension (with a . prefix):

https://github.com/avajs/ava/blob/2fc7d56475ca1d77078abc3e08390341bedda58f/lib/worker/precompiler-hook.js#L34

It's called here:

https://github.com/avajs/ava/blob/2fc7d56475ca1d77078abc3e08390341bedda58f/lib/worker/subprocess.js#L108

The extensions should be available under options.extensions.all but you may want to double-check.

We should add an integration test here: https://github.com/avajs/ava/blob/master/test/integration/babel.js

In the future, there will also be ES modules with several extensions.