Skip to content
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

Error running with Babel 6.x (ReferenceError: [BABEL] ... Unknown option:.babelrc.presets) #287

Closed
radiovisual opened this issue Nov 30, 2015 · 2 comments

Comments

@radiovisual
Copy link

Hey there AVA Team!

I wanted to move my unit tests from mocha to AVA, because AVA seems super cool, but I haven't been able to run any tests yet due to this strange problem:

When I run this command:

$ npm run test

Which invokes this line from my package.json file:

"scripts": {
    "test": "ava"
  } 

the output I get is this:

Michaels-iMac:someapp michael$ npm run test

> [email protected] test /Users/michael/gitprojects/someapp
> ava


Uncaught Exception:  /Users/michael/gitprojects/someapp/test/test.js
  ReferenceError: [BABEL] /Users/michael/gitprojects/someapp/test/test.js: Unknown option: /Users/michael/gitprojects/someapp/.babelrc.presets
    at Logger.error (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
    at OptionManager.mergeOptions (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
    at OptionManager.addConfig (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
    at OptionManager.findConfigs (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
    at OptionManager.init (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
    at File.initOptions (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/index.js:147:75)
    at new File (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/file/index.js:137:22)
    at Pipeline.transform (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at Object.transformFileSync (/Users/michael/gitprojects/someapp/node_modules/babel-core/lib/api/node.js:137:37)

Error: Test results were not received from: /Users/michael/gitprojects/someapp/test/test.js
    at ChildProcess. (/Users/michael/gitprojects/someapp/node_modules/ava/lib/fork.js:51:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
From previous event:
    at module.exports (/Users/michael/gitprojects/someapp/node_modules/ava/lib/fork.js:23:16)
    at run (/Users/michael/gitprojects/someapp/node_modules/ava/cli.js:135:9)
    at Array.map (native)
    at /Users/michael/gitprojects/someapp/node_modules/ava/cli.js:216:25
From previous event:
    at init (/Users/michael/gitprojects/someapp/node_modules/ava/cli.js:207:4)
    at Object. (/Users/michael/gitprojects/someapp/node_modules/ava/cli.js:253:2)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

You can see I get this ReferenceError:

ReferenceError: [BABEL] ... Unknown option: .babelrc.presets

Even though I have a valid .babelrc file:

{
  "presets": ["es2015", "stage-3"]
}

And then the error says Error: Test results were not received from: /Users/.../someapp/test/test.js

If I run babel on its own, it works just fine. But when I run AVA, I get the Babel error above.

I know Babel has had some growing pains from 5.x to 6.x, but even after I have tried cleaning up my node_modules directory and cleaning the npm cache, I still get this error.

If it helps, here are my babel dependencies:

"dependencies": {
    "babel-runtime": "^6.2.0"
  },
  "devDependencies": {
    "ava": "*",
    "babel-cli": "^6.2.0",
    "babel-plugin-espower": "^2.0.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-stage-3": "^6.1.18"
  },

Any ideas? Is this happening because AVA is not ready for Babel 6.x, or am I overlooking something?

Thanks!

@radiovisual
Copy link
Author

Update: I am currently working around this issue by employing Babel 5.x in my app, which allows me to use AVA without incident.

Here are my Babel 5.x dependencies which allow me to test with AVA:

"dependencies": {
    "babel-runtime": "^5.8.29"
  },
  "devDependencies": {
    "ava": "*",
    "babel": "^5.8.23"
  }

I think I may have just gotten a little ahead of myself and posted this issue without realizing that the AVA team is currently working on getting AVA ready for Babel 6.x.

Thanks for all your hard work! 😺

@jamestalmage
Copy link
Contributor

Yep, we are working on it.

Closing as a duplicate of #117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants