-
Notifications
You must be signed in to change notification settings - Fork 31
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
Generating coverage over a series of separate invocations (and docs for that!) #68
Comments
Yeah, this is definitely possible. I was going to say "easy" but I gave it a quick go and it turns out to be more complicated than I thought it would be. :) If you check out the section on mixed coffee and JS projects, you'll find a big hint. It shows how to drive coffee-coverage from istanbul, and you can run istanbul to cover any executable (provided that executable doesn't fork a child). So I would have thought you could do:
But this doesn't actually work. :P You need to require coffee-script/resister, because coffee-coverage/register-istanbul relies on it, and weirdly coffee-script loads up But, you can make this work by creating a small js file. Create, for example, launcher.js:
And then you can:
and this works. As for multiple invocations, when you run
Or, if you want something slightly less verbose:
which should work well (provided you're not very low on PIDs. :) Is that helpful? If you get this working, I'd gladly accept a PR for a HOWTO for running generic commands. |
Yeah, I discovered some of the same stuff shortly after submitting this! At least, that I'm going to make a go of it later on, and I'll get back to you as to whether I was able to do it usefully without writing JavaScript glue. |
Hi, first of all, thanks for creating a great npm package. At our test environment, we succeeded to generate coverage of command invocations written in Coffee! Here is the gist of it (sorry for being too terse, I'll tidy up this once I have some spare time):
|
By the way, I found a bug in CoffeeScript, so I filed an issue for that: jashkenas/coffeescript#4209 |
So, my project includes a command-line executable; and to exercise that, I don't use JavaScript tests, but shell-script ones (specifically, using bats).
Can I generate coverage reports when not executing any JavaScript test suite at all, just an arbitrary executable (i.e. covering the results of
my_exec --blah
)? More importantly, can I generate a single coverage report that covers multiple invocations (i.e.mocha my_tests
, and then latermy_exec --blah
,my_exec --widget
)?If this is possible: it'd be great to see this covered in your excellent new HOWTO writeups! Command-line apps are common in npm, and getting full coverage information for them would be ideal. (=
The text was updated successfully, but these errors were encountered: