grunt-mocha-phantomjs
grunt-mocha-phantomjs copied to clipboard
Report output contents get truncated
When I use the json-cov reporter and output to a file (like in the setting below) the contents of the file get truncated. It ends up being invalid json with missing data.
mocha_phantomjs: { coverage: { options: { reporter: 'json-cov', output: 'coverage.json', urls: ['http://url/to/index.html'] }, }, }
If I run mocha_phantomjs from the command line like so...
mocha-phantomjs -R json-cov http://url/to/index.html > coverage.json
... then I get a completely populated file. This leads me to believe it's either an issue with the grunt plugin or with grunt itself. If it matters, the truncated file ends up being about 648k and the fully-populated file is 965k.
Can you give this branch a shot and see if it works correctly? https://github.com/jdcataldo/grunt-mocha-phantomjs/tree/json-cov
My output file is still getting truncated when I replace the current grunt-mocha-phantomjs with this branch. Just to make sure I tested this correctly, here are the steps that I followed:
- Downloaded the zip from the link above
- Extracted the zip and ran
npm install
in the extract directory. - Ran
grunt
in this dir... all steps passed - Deleted all contents from the current grunt-mohca-phantomjs dir under node_modules in my project
- Copied in all contents from the newly extracted branch into node_modules
- Re-ran my gruntfile
I really appreciate the quick turnaround in you looking at this for me. I currently have a workaround of just using a grunt step to shell out a call to mocha-phantomjs to create the coverage output, but I'll be happy to test any more fixes for you.
You can put this in your package.json and run npm install.
"grunt-mocha-phantomjs": "git+ssh://[email protected]:jdcataldo/grunt-mocha-phantomjs.git#json-cov"
Delete out the existing grunt-mocha-phantomjs in your node_modules directory. This change should just pipe the output to the file you specified. I will try to create a large test suite to see if I can reproduce it.
I just merge my change into master and published. I also generated a test-cov folder. The coverage.json that gets generated is 1.4 MB. Not sure why your file is getting truncated. You can try running grunt in the grunt-mocha-phantomjs folder and see if you get the same result.
Thanks for doing that. I just installed the latest version, installed, and ran grunt. All of the tests show as passing, but when i opened up the coverage.json file it was truncated. Mine ended up being 1.06MB.