For example I want destructuring in my source code, which should be supported natively in a few weeks with the release of Node v6 so transpiring my source with Babel is more inconvenient than simply running node --harmony_destructuring
My hack/workaround at the moment is to edit the first line of the node_modules/ava/cli.js:
#!/usr/bin/env node --harmony_destructuring
I guess we could pass all flags after a double-dash to node, like $ ava -- --harmony_destructuring.
This should also work, and is more explicit: node --harmony_destructuring node_modules/.bin/ava.
What happens with the following set up in that case?
package.json:
{
"scripts": {
"test": "ava -- --harmony_destructuring"
}
terminal:
$ npm test -- specific-test.js
@vdemedes I'm pretty sure the argument would go to node, not AVA.
That's not something we want though. Although this case should not occur often, so we might just roll with it.
I'd prefer users do node --harmony_destructuring node_modules/.bin/ava.
@bencooling Wont ava still transpile using babel though?
Also, Node.js 6 will be released on the 26th and then there won't be a need to run node with flags anymore...
Also, Node.js 6 will be released on the 26th and then there won't be a need to run node with flags anymore...
No. There will always be new features behind flags.
@bencooling Wont ava still transpile using babel though?
@LinusU I believe Ava runs your tests through Babel not your source code.
I'm quite sure that all code (except node_modules) is run thru babel
@LinusU by default only test files are run through Babel.
I stand corrected, sorry about that
I agree with @novemberborn
node --harmony-flag node_modules/.bin/ava
Node already provides a working solution, no reason to create our own.
Closing. If someone feels that's premature, feel free to reopen.
node --harmony node_modules/.bin/ava does not work on windows 10
Try node --harmony node_modules/ava/cli.js -- the contents of the .bin directory are shell scripts and shouldn't be runnable by node.
Most helpful comment
I agree with @novemberborn
Node already provides a working solution, no reason to create our own.
Closing. If someone feels that's premature, feel free to reopen.