Skip to content

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