-
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
Transpile dependencies of the test file #111
Comments
Did you try What version of Node are you using? Something tells me Babel was removed from compiling tests. |
yup, still the same, btw it might be the same as #108 ? |
Yep, that's my guess. |
So right now there is no way to test modules directly? I mean, i have to transpile them first, and test the transpiled files? |
Implicitly transpiling dependencies in 0.2.0 was a bug that was later fixed 0.3.0. Transpiling dependencies by default is both surprising and slow. I'm open to considering an option for enabling this, but it will not be by default. |
what about allowing something like |
That won't work as we spawn the test files. Just use AVA 0.2.0 until we've figured out how to deal with this. Alternatively use a fork where you've removed this line. |
I agree. I want to run both tests and target codes for tests with Babel. I think that is proper and as it should be. |
What should the option be named? |
@floatdrop Any thoughts as to how we should solve this now that #103 has landed? |
@madbence you can require file with following code in tests as workaround: // app.es5.js
require('babel/register');
require('./app'); @sindresorhus besides this workaround, not really. |
We could set the |
full conversion pending on ava transpiling depended files (see avajs/ava#111)
Hm, any progress on that? Still can't use external files. |
@theaqua This issue is still open, so no. @floatdrop has already provided a workaround if you can't wait. To move this issue forward, come up with a good name for a CLI flag to enable it. |
pm2 uses |
|
@madbence I like I think Then again, "transpile" a general term. As AVA specifically transpiles using Babel, maybe "babelify" would be a better word. |
|
@Qix- |
Per GNU specs on arguments, |
btw what's the rationale behind this behavior (ava transpiles tests only)? it's just slow? |
It is more than just "ava transpiles tests only". It is that ava allows you to write tests in ES2015 with zero impact on your production environment. For example, we make sure // Always works in tests. Only works in production in Node >= 0.12
new Promise(...) Trickier still is a prototype polyfill. Something like AVA uses the runtime plugin to provide polyfill aliasing. An example of how that works is here. This means that: ".... some string ....".includes() Will work in your tests on any platform. But will throw in production code on platforms that do not support |
+1 for a Including |
|
@sparty02 Sure, PR welcome. |
Hi! |
You need to install as dependencies of your own project to use outside of tests |
Already done that @jamestalmage |
It was purely a problem with babel presets/plugins/config settings, nvm, thanks a lot |
EDIT: Whoops... Not the issue I thought it was. Sorry! |
:) |
for anybody trying to make |
@Hurtak: Yes. Babel 6 doesn't do anything by default. |
This issue is solved for me by adding {
"presets": ["es2015", "stage-2"]
} |
If you're interested, here's a migration from Mocha to AVA in a small library: https://github.com/kentcdodds/starwars-names/pull/12/files?w=1 edit the reason I bring it up is because it supports ES6 with Babel 6 in my source without having to |
Cool! Your use of the We would value any feedback on pain points you encountered during the transition. |
Cool, I added a comment about that. I prefer to use Not really any pain points. The only thing that I would say is the assertions are pretty limiting. I prefer the declarative syntax of something like Chai. But I expect that the small surface area of the API is intentional. I ended up bringing in another utility library to make testing a little more declarative though. |
This is what I use in my package.json file:
|
Had to dig around this issue this morning to get it working with [email protected] in order to run on travis with [email protected] and [email protected] I had to use the require('babel-core/register')({
ignore: false
}); TIP: |
@sindresorhus @vdemedes @jamestalmage is there anything we want to improve here beyond the existing |
Not that I'm aware of. |
Sure, we can close it for now. |
@Whoaa512 dude you rule |
[email protected]
works smoothly on a clean project, but fails to run on mine (tests broke when i've upgraded to from[email protected]
):I'm sure it's caused by some weird
babel
dependency, so it might be unrelated toava
. Last working state is 7d31571, if i try to upgrade to[email protected]
, tests are broken.I will investigate it tomorrow...
The text was updated successfully, but these errors were encountered: