Add support for namespaced suites for JavaScript unit tests.
Review Request #5727 — Created April 22, 2014 and submitted — Latest diff uploaded
Unit tests using Jasmine consist of files each wrapping a series of
tests and definitions in one bigdescribe()
call. For organization,
we've been using the convention of namespacing these, in order to see
whether a test suite is part of, say, the API resources code, or the
diffviewer views code, allowing for easily searching on the page.
However, this still makes it hard to run a subset of tests, when they
span multiple files.This introduces a new Jasmine utility library, jasmine.suites, which
allows us to replace that bigdescribe()
all with asuite()
call. This
will generatedescribe()
calls for us, reusing existing ones for
previously registered levels of the namespace tree. The result is that,
instead of running all tests to see if all resource tests pass, we can
now just run the "resources" suite independently. It's equivalent to
moving all tests into one big file and wrapping the resources tests in
its own bigdescribe()
call.This utility library will be released externally as its own independent
module, but I'm putting it here for review purposes for now.
Converted all unit tests in RB and Djblets to use this. All tests ran,
and I saw the same test count as before they were ported over.I was able to run various suites of tests, and didn't see any duplicates
or any issues running them.