-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Full coverage suite with istanbul #65
Conversation
Added some additional ignore paths to .gitignore and .hgignore Created Cakefile to provide test coverage infrastructure Added devDependencies to package.node, to facilitate test coverage Created node/test directory to hold test source files (CoffeeScript) Created coverage tests for node-shim.js, rot.js, and text.js Created some Node-specific documentation in node/README.md Created coverage tests for array.js, number.js, string.js, object.js, function.js, and raf.js Created coverage test for display.js Created coverage test for backend.js, rect.js Created coverage test for hex.js, rect.js
Created coverage test for tile.js Modified node-shim.js to include stub for clearRect()
Created coverage test for rng.js
Created coverage test for stringgenerator.js
Created coverage test for eventqueue.js
Re-organized test source files into directory structure that matches src/ Updated paths to support new folder structure Fixed RAF-loop bug in display/displayTest.coffee Annotated display/rectTest.coffee with no-coverage method placeholder Created coverage test for scheduler/scheduler.js
Annotated node/nodeShimTest.coffee with no-coverage method placeholder Created coverage test for engine.js Created coverage test for scheduler/scheduler-action.js Created coverage test for scheduler/scheduler-simple.js Created coverage test for scheduler/scheduler-speed.js
Annotated display/displayTest.coffee with no-coverage method placeholders Fixed errant console.log statements left in engineTest.coffee Added coverage for clearRect() in node/nodeShimTest.coffee
Added missing coverage for _tick and _draw methods of Display
Added missing coverage for _drawNoCache method of Rect
Added coverage tests for src/map directory Updated istanbul and mocha versions in package.node
Added coverage tests for src/noise Modified rngTest.coffee to be a little less picky
Added coverage tests for src/fov
Added coverage tests for color.js
Added coverage tests for lighting.js Modified rngTest.coffee to not be so picky about RNG seeding Modified colorTest.coffee to not fail due to unclamped random colors
Added coverage tests for src/path
Added coverage tests for Node.js's "term" terminal layout
Final cleanup of coverage suite after merge from ondras/master
Wow, impressive! I have no idea how exactly this works, but it looks like you need to provide (duplicate) server-side unit tests to have almost all lines of the code execute? Those coffeescript unit tests look suspiciously similar to some of those existing jasmine-based browser tests. Is there a way to reduce this duplicity? I will merge this anyway, of course. |
Full coverage suite with istanbul
Thanks for this tedious work! |
CoffeeScript has a Cakefile, which is similar to a Makefile, except it's just a CoffeeScript source file with a few helper functions.
task 'coverage', 'Perform test coverage analysis', ->
clean -> compile -> test -> coverage() Which is really just cute syntatic sugar for this (JavaScript): task('coverage', 'Perform test coverage analysis', function() {
return clean(function() {
return compile(function() {
return test(function() {
return coverage();
});
});
});
}); So first we Then we
Then we
Finally we
In the report, you'll see every line, every branch, every function that did/did not get executed. I organized the test suite according to the source tree. That is, The tests are also organized as follows:
This was so that finding the specific tests for a very specific part of the source would be easy as well. Between the report itself and studying the code to figure out how to write a test that would cover each line, each branch, each function, etc. that's why I was able to find so many micro-issues.
Yes, The biggest differences (that I've noticed), are that mocha doesn't give you I'd have to study it a little more, but there's probably a way to get the mocha tests to run under the jasmine spec runner. We'd have to figure out where everything should live (and make some nice targets for the Makefile), but we could reduce some of the duplicate tests that way. I need a short break from writing tests for awhile, but I'll start looking at ways to combine/improve the testing, maybe around the start of June. All in all, I think it was worth it! :-) |
Thanks for this complex explanation. One really learns new stuff every day. |
The source of all the micro-issues in #61 ...
A full (98+%) coverage suite for the statements, branches, functions, and lines of rot.js.
Instructions for generating the coverage report in
node/README.md
; requires Node.js.