Closed jsardev closed 5 years ago
@babel/register
doesn't consult AVA's configuration. You haven't configured how it should compile the source files. Thus you get a syntax error when you try to load a source file (through @babel/register
). It doesn't get compiled so the JSX syntax ends up breaking it.
Using .babelrc
or babel.config.js
is the correct approach.
(I'm closing this issue for housekeeping purposes, but let's keep the conversation going.)
@novemberborn Uhm, well, I guess I misunderstood how it works. When I put a second thought on this topic it totally makes sense that ava's babel
config property has nothing to do with what you put in require
(because... why? 😄). Thanks for clarifying this and sorry for taking your time unnecessarily 😄
Description
I've followed the latest babel recipe to configure
ava
in my project to use it withReact
. Unfortunately, specifyingbabel
configuration via theava
property inpackage.json
doesn't work. What's interesting is that using the samebabel
presets in.babelrc
makeava
work properly.Test Source
Subject:
Test:
Error Message & Stack Trace
Config
Non-working:
package.json
Working:
package.json
.babelrc
Command-Line Arguments
Just
ava
.Relevant Links
I've created a reproduction repository with a non-working and working example.
Using
ava
property inpackage.json
: https://github.com/sarneeh/avajs-ava-issues-1968/tree/master Using.babelrc
: https://github.com/sarneeh/avajs-ava-issues-1968/tree/working-exampleEnvironment
Node:
10.9.0
Ava:1.0.0-rc.1