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

Document how to use babel-polyfill to polyfill the test environment #727

Closed
novemberborn opened this issue Apr 6, 2016 · 7 comments
Closed

Comments

@novemberborn
Copy link
Member

AVA does not load polyfills when running tests. This means features like ['foo', 'bar'].includes('foo') are not available. We should update the ES2015 docs to point this out, and add a recipe explaining how to use babel-polyfill with AVA.

There should be a caveat to the latter that users shouldn't load babel-polyfill unless they also use it in their applications, since the polyfill will apply to both test and source files.

See #263 for background.

@ahmednuaman
Copy link

Isn't it just about having this in the package.json:

"ava": {
  "require": [
    "babel-register",
    "babel-polyfill"
  ]
},

@sotojuan sotojuan removed their assignment Dec 20, 2016
@florianb
Copy link

@novemberborn: following Sindre's call to the weapons - i'd like to take this issue if it is still relevant and nobody else is working on it!

@novemberborn
Copy link
Member Author

@florianb that's awesome, go for it!

@florianb
Copy link

@novemberborn - it seems like this issue is invalid, since Array.include() is being part of the standard from ES2016+. Ava seems to support ES2017 out of the box, there is no ES2015-sepecific section in the docs anymore.

However, i might be wrong or i also could still add an ES2015-section to the docs. I'd appreciate any hint. 😄

@novemberborn
Copy link
Member Author

Ava seems to support ES2017 out of the box, there is no ES2015-sepecific section in the docs anymore.

ES2017 includes ES2015 😉

https://github.com/avajs/ava/blob/master/docs/recipes/babelrc.md has further details beyond what is in the main README. The issue is that we can only transpile syntax, we don't modify built-ins. It's documented in https://github.com/avajs/babel-preset-stage-4, which is linked to, but we could spell it out better in at least the babelrc recipe.

This is why we should still document babel-polyfill.

@florianb
Copy link

Aye - i then will add a proposal for the babelrc. Thanks for clarification.

@florianb
Copy link

@novemberborn: Change drafted, i would appreciate any feedback and since this is my first contribution i guess there is room for improvement. Thank you very much in advance.

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

No branches or pull requests

4 participants