Simple JS unit testing framework similar to QUnit.
gt requires nodejs and a few modules to run. Assuming you wrote a few qunit tests in tests.js:
npm install -g gt gt tests.js some of the options (-h for all): -l <debug level> 0 = debug, 1 = default, 2 = warnings, 3 = errors -r <report level> 0 = all (default), 1 = failed tests only
A simple example is in examples subfolder
Unit tests follow QUnit approach:
gtmodule"Basic tests";gttest"get N '='"gtoktypeof getLines === "function" "getLines is a function";gtequalgetLines0 "" "0 character";gtequalgetLines1 "=" "1 character";;
Creates unit test report (stdout only) and JS code coverage (stdout plus Lines of Code + HTML in folder cover)
gt ./examples/basic/tests ./examples/basic/exceptionTests
Sample unit test output image
Sample JS coverage output image
You can write your unit tests using coffeescript, which allows very concise code. So far, the code coverage does not include the unit test files themselves, they will be omitted from the coverage report. See examples/coffee folder.
See example examples/browser
The MIT License, see MIT-License.txt
Gleb Bahmutov email@example.com