-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fresh AVA 7.0.0-rc.1 install displays "SyntaxError: Unexpected token import" on any ES6 import source #1905
Comments
Sorry you're having problems with this @onexdata. The issue is that AVA only compiles your test files. But since you're using ES module syntax, you need to compile source files too. Going by what you've posted here I don't think you have a Babel compilation step? That would explain why the Babel recipe didn't help — you may not have configured Babel for You may be interested in using the (I'm closing this issue for housekeeping purposes, but let's keep the conversation going.) |
Well I'm trying to use AVA for node only, and Node 8.x supports ES6 / import out of the box, so there is no compilation step or need for Babel. I'm a little puzzled what is going on since the test itself uses the import statement, yet the code the test is testing also uses it, but fails. Is there some kind of directive that tells AVA not to use ES6 that I can bypass? This is only for server/Node/back end code and has nothing to do with the front-end and never will. |
The link you gave has a link to disable AVA's use of Babel all together and here: It suggests putting this in package.json:
But when I do that I get this:
The URL the error suggests (https://github.com/avajs/ava#es2017-support) doesn't exist (the anchor doesn't exist so it just goes to the main page) |
Oh my GOSH Node doesn't even support import yet 😧 ... Thanks. smacks forehead |
Yes it's all a little bit confusing. I wonder if we should default to CJS instead, see #1908. Would love to know if that would've helped you in this case. |
Description
yarn init
yarn add ava
source files:
obj.js:
main.js:
Test Source
Error Message & Stack Trace
Config
Command-Line Arguments
Environment
Windows 10, Node 8.11.3 LTS, Ava 1.0.0-beta.7, npm 5.6.0
The text was updated successfully, but these errors were encountered: