-
Notifications
You must be signed in to change notification settings - Fork 307
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
How to make it work with Harmony/ ES6/ ECMAScript6 ? #282
Comments
Thanks for writing! In order to keep the bug tracker focused only on the development of Intern itself, we ask that people please follow the contribution guidelines and not submit questions to the bug tracker. Please read the Getting Support wiki for information on where to submit questions. Once an Istanbul release supports ES6 we will be sure to upgrade dependencies to the supported version so it will Just Work. Thank you again for your interest! |
Seems it still doesn't work, were you able to figure this out @BrainCrumbz? |
No. We just dropped the whole thing at that time. |
In case it's of use to you, all of the code and tests we run in Intern are written in ES6. We get it to run by using Babel to cross-compile it all over to ES5 beforehand. (It's all automated in gulp, so it's automatic and instantaneous.) That might not work for you if you're just interested in pure Harmony execution, but it works for us as we're ultimately targeting browsers that don't do ES6 properly anyway. Also, be aware that one major pain area there is that Istanbul doesn't yet cope with reading in the source maps, so we can't get accurate coverage information against the ES6 source, only against the transpiled ES5. |
If you want to run tests and just not have code coverage for the time being (as you’d get with any other testing system), you can set If full ES6 code instrumentation is something you want I am sure that the esprima/istanbul folks would be happy to receive patches, but I don’t think the native implementations are ready for primetime yet. |
I don't need instrumentation, but it doesn't seem to work with generators. I run it as
It passes but it should fail.
|
What do you expect the result to be when you pass a generator instead of a function? |
The Even though Mocha supports ES6 too it still needs the https://www.npmjs.com/package/co-mocha library to be |
We can probably support a generator-like function natively but it should be done under a new enhancement request. The API right now doesn’t say you can pass a generator, only a standard function that returns a promise. |
@csnover Latest version of Istanbul (0.3.17) has an updated esprima dependency which apparently has better support for ES6. Any chances we can get an Istanbul version bump to 0.3.17 for Intern 3.x? gotwarlost/istanbul#66 |
If Istanbul could do ES6 coverage properly, is that all that is in the way of using Intern for both unit and functional tests, complete with coverage? I ask because I'm in the midst of figuring out a new functional framework for my company. If I don't care about coverage of the app for now, how painful is it to use ES6 features inside the test code? |
@parametrization presumably you are still using Babel to transpile your ES6 code into something that can be run in all browsers today? In that case, it's just a matter of following the steps at https://theintern.github.io/intern/#testing-other-module to test transpiled code (for example, https://github.com/theintern/intern-examples/blob/master/react-example/tests/support/jsx.js is how you could test React code that uses JSX), or to just transpile everything from ES6 modules to AMD modules prior to testing (e.g. like we suggest for TypeScript testing at https://www.sitepen.com/blog/2015/03/24/testing-typescript-with-intern/ ). So I would think you can write your tests using ES6, and use Babel to transpile your tests into ES5 + AMD modules, and then then run them. |
@siboulet We're late into the release candidate stage for Intern 3, but it's up to @csnover and @jason0x43 to decide on that, or if we wait until 3.1 or 4.0 for a change to Istanbul. |
I opened a separate ticket at #445 for tracking the Istanbul update. |
Hello there. We're trying to setup intern to work with ES6 JavaScript code.
Until now we were able to (temporarily) edit
intern-client.cmd
(on Windows) so that node runs with--harmony
option and so to overcome the initial errors.But then other errors show up, like here below:
After some search, it seems those are due to Istanbul dep, not being able to handle ES6 (gotwarlost/istanbul#141, gotwarlost/istanbul#66), which in turn depends also on esprima and escodegen for that (gotwarlost/istanbul#129).
We kinda understood that there should be ways to pull this tools from some dedicated Harmony branches, not from the master. Could you please help us to figure out how to set up all that within intern?
Thanks
The text was updated successfully, but these errors were encountered: