Skip to content
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

-C flag for generating and reporting test coverage for all files in working directory #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

coreh
Copy link

@coreh coreh commented Jul 12, 2011

Hi, I recently started using expresso, and I specially liked the code coverage output feature. However, I was initially surprised by the -c flag behavior. (Instrument the code in lib/, save in lib-cov/, then unshift it to require.paths)

Since my project has code outside of the lib folder I would like to report the coverage, I had to manually run node-jscoverage and then run expresso. I considered making a script to automate this, but I thought that perhaps a new flag on expresso that did the work for me would be a nice addition.

What this code does:

When the -C (or --cwd-coverage) flag is supplied, expresso will create a temporary folder and run node-jscoverage with the working directory as a source and the temporary folder created as a destination.

It then will move the temporary folder with the instrumented code to a hidden .jscoverage/ directory, nested in the working directory, chdir into it and run the specified tests there.

It's smart enough not to regenerate the instrumented code if no files were changed (it does that by checking the last modified dates), allowing users to run individual test cases without having to wait for node-jscoverage to run again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant