-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Babel/ES2015 Support #58
Conversation
Fantastic! Thanks! |
…nd babel-core/register see #55
// @jamestalmage @vdemedes |
Couple things:
|
@shannonmoeller is babel-polyfill an alternative to using Things worked well otherwise? You'd be happy to see this land? |
Ah. It's because I'm using async/await in my test file. I'd absolutely love to see this land. Once Thanks for your work on this! 👏 |
@shannonmoeller do you think that |
As long as it's clearly documented as a feature of the What about having a // package.json
{
"config": {
"nyc": {
"require": ["babel-polyfill"]
}
} |
@shannonmoeller I like this concept for the API much better than having a see: 1735bfd And let me know if this does the trick for you:
|
Now that's beautiful. This is working perfectly for me: {
"name": "foo",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"coveralls": "nyc report -r text-lcov | coveralls",
"test": "nyc -r html -r text blue-tape test/*.js",
"watch": "watch 'npm run test' src test -d"
},
"devDependencies": {
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"babel-register": "^6.2.0",
"blue-tape": "^0.1.11",
"coveralls": "^2.11.4",
"nyc": "git+https://github.com/bcoe/nyc.git#1735bfdc",
"watch": "^0.16.0"
},
"config": {
"nyc": {
"require": [
"babel-register",
"babel-polyfill"
]
}
}
} |
I really like how this change makes this a bring-your-own-transpiler coverage tool. Should work just as easily with coffeescript and typescript now. |
@bcoe Yes, this:
👍 |
I get {
"scripts": {
"test": "nyc tape \"./test/**/*.js\" | faucet",
},
"config": {
"nyc": {
"require": [
"babel-register",
"babel-polyfill"
]
}
},
"devDependencies": {
"babel-cli": "^6.2.0",
"babel-core": "^6.2.1",
"babel-preset-es2015": "^6.1.18",
"faucet": "0.0.1",
"istanbul": "^0.3.17",
"lodash": "^3.10.0",
"nyc": "git+ssh://[email protected]:bcoe/nyc.git#babel",
"pegjs": "^0.8.0",
"sql.js": "^0.2.21",
"tape": "^4.0.1"
}
}
With this setup, however, "scripts": {
"test": "babel-node $( which tape) \"./test/**/*.js\" | faucet",
"coverage": "nyc npm test --reporter lcov",
} Can you see what I'm doing wrong in the former case? |
@jwhitfieldseed is the code your instrumenting open-source, mind linking me to the project and I'll take a look? @Janpot did you give that a shot with a couple of your projects? I'd like to publish this pretty soon 👍 |
@bcoe nvm, 👍 for |
@bcoe actually, scratch that. This setup works with [email protected], fails with [email protected] (after https://github.com/jwhitfieldseed/prequel/blob/master/package.json Error with node 4.1.1:
|
@jwhitefieldseed Looks like you need to Edit: Corrected typo in install command. |
@shannonmoeller That didn't fix it, I'm afraid. At first thought it was a problem with Babel 6 config rather than
And this fails immediately with the above
Both work on Node 5. |
@shannonmoeller Ah - |
Yep! Sorry about the typo. |
@shannonmoeller @jwhitfieldseed, given that you now explicitly specify a list of libraries to require, perhaps I should stop using |
@bcoe Sounds good to me. |
@bcoe 👍 I would have caught the difference between Node 4 and Node 5 (or as I now realise, npm 2 vs npm 3) immediately with an early |
@mindmelting just published a hot-fix of Let me know if it does the trick? |
with the
--babel
flag, nyc is the easiest way to add ES2015 support to your project:npm i babel-core babel-preset-es2015 --save
)..babelrc
file:--babel
flag:nyc uses source-maps to map coverage information back to the appropriate lines of the pre-transpiled code:
This is a pretty big change, and I would love some help with the code review, you can try it out in your project by running:
I hope it solves the problems folks were having with nyc + babel:
CC: @Janpot, @shannonmoeller, @lfilho, @sindresorhus