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 ES7 configuration with babel for ava #513

Closed
ghost opened this issue Feb 5, 2016 · 4 comments
Closed

Document ES7 configuration with babel for ava #513

ghost opened this issue Feb 5, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Feb 5, 2016

The documentation includes information on how to get ES6 support for ava, which is great. Would it be possible to include docs on how to get ES7 in also?

Here's a realistic use case:

A React component with the @connect() decorator from Redux:

import React from 'react';
import { connect } from 'react-redux';

@connect()
class Foo extends React.Component {

}

A test file for unit testing it:

import test from 'ava';
import { isElementOfType } from 'react-addons-test-utils';
import 'babel-core/register'; // as per docs

var Foo = require('../src/foo.jsx');

test('foo ', t => {
  const simpleFoo = React.createElement(Foo);
  t.ok(isElementOfType(Foo, simpleFoo));
});

I tried using a shim that apparently worked for people back when iojs was separate, but the namespaces don't match anymore:

require("babel/register")({
  optional: ['es7.asyncFunctions']
});

On the other hand, this guy claims ava supports es7 without any extra effort.

Either way, it would be nice to get some documentation on this--I'm interested in using ava going forward.

@ghost
Copy link
Author

ghost commented Feb 5, 2016

This didn't work either:

require("babel-register")({
  optional: ["es7.decorators"]
});

@Whoaa512
Copy link

AVA used to implicitly read in your local .babelrc file before 0.10 (See #398) which would allow you to use es7 or any arbitrary babel plugins.

See #448 to contribute to the discussion on how customizable babel options should be handled.

@sindresorhus
Copy link
Member

Yes, we need to resolve this soon. We need more feedback on #448 ;)

@novemberborn
Copy link
Member

Closing this in favor of #448, under the assumption that the implementation would be obvious once that lands.

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

3 participants