jeffrifwald / babel-istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
144 stars 23 forks source link

Allow passing options to Babel again, please! #38

Closed thealjey closed 8 years ago

thealjey commented 8 years ago

Instrumenter.prototype.instrumentSync has a very handy option babelConfig, which run-with-cover.js is not passing to it. Simply creating a .babelrc file is not an option for me.

The only thing I do not like about Babel right now is that it does not have a --config option and you cannot set a specific configuration file to use. It's not a problem for projects that are using Babel directly, but it is for a reusable library.

Would you be so kind as to allow passing options to Babel and not rely solely on .babelrc, or at least add a --config option of your own? Pretty please :smiley_cat:

Thank you!

thealjey commented 8 years ago

I could try to whip up a PR if that's ok with you.

jeffrifwald commented 8 years ago

Yeah that'd be great if you want to add a --babel-config option for specifying the babel config.

thealjey commented 8 years ago

Just to be clear - --babel-config would be a path to a json file, with the same purpose as .babelrc, but with a benefit that you'll be able to choose which one to use exactly instead of the weird Babel way of searching the file system, right?

jeffrifwald commented 8 years ago

Yeah, you'll likely need to read in that json file and pass it to the babel.transform function in the instrumenter. Make sure to override those options to ensure the source map is still going to be generated. The options sourceMaps and filename are the two that babel-istanbul relies on to get its job done.

thealjey commented 8 years ago

39 - the PR is ready for review :pray:

thealjey commented 8 years ago

@jmcriffey hi, sorry for bothering)) could you please review #39?