This first part of the testing framework upgrade: - enhances the jsdoc script to allow switching to debug mode from the command line - uses Jasmine to run tests - adds flexibility to run tests from multiple root directories - does automatic test discovery, so test files can just be created, dropped in an appropriate folder, and run without having to explicity add it to the test runner - cleans up the test directory layout - incorporates env.rhino.js which should make it easier to test templates - is incomplete: this is just a savepoint. About 1/3 of the tests have been converted. The rest are still run through the old testrunner
Testing JSDoc 3
Running Tests
Running tests is easy. Just change your working directory to the jsdoc folder and run the following command on Windows:
jsdoc -T
... or on a Max OSX or *nix platform:
./jsdoc -T
If you can't get the short-form commands to work, try invoking Java directly:
java -cp lib/js.jar org.mozilla.javascript.tools.shell.Main \
-modules node_modules -modules rhino_modules -modules . \
jsdoc.js -T
Writing Tests
Adding tests is pretty easy, too. You can write tests for jsdoc itself (to make sure tags and the parser, etc. are working properly), tests for plugins, and/or tests for templates.
JSDoc 3 uses Jasmine (https://github.com/pivotal/jasmine) as its testing framework. Take a look at that project's wiki for documentation on writing tests in general.
Tests for JSDoc
And take a look at the files in the test directory for many examples of
writing tests for JSDoc itself. the test\fixtures directory hold fixtures
for use in the tests and the test\tests directory holds the tests themselves.
Tests for plugins
TODO:
More info for contributors about how tests work and about plugin/template tests