avajs / babel

Babel provider for AVA.
11 stars 3 forks source link

AVA only loads Babel-compilation output for .js files #10

Closed novemberborn closed 4 years ago

novemberborn commented 5 years ago

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

rauschma commented 5 years ago

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