Testing client side apps requires a couple of tedious steps: Organizing the git
clone, the dependencies, wrangling up a web server, the test framework, etc.
When testing a plugin for jbrowse, the dependency tree is interesting because
the plugin "depends" on JBrowse to run, but we will use travis-CI and bower
inside the git repo for our plugin to accomplish this.
In this scenario, we will
Use bower to install jasmine and JBrowse (our platform that we write the
plugin for)
Use nginx to launch a webserver on travis-CI
Use the phantomjs run-jasmine.js script to check jasmine test results
The key thing here is that it installs jasmine and JBrowse. I set .bowerrc to
install both jasmine and JBrowse to the "test" directory
With this setup, bower will make a "flat dependency tree" in the test directory,
so it will look like this
Here the asterisks indicate things that are part of our app, other's are
automatically installed by bower (jbrowse, jasmine-core, the dojo dependencies,
and other things)
Then we can create the jasmine test/index.html to be something like this
The "packages" in the require statement puts all these packages in the right
"namespace" for the AMD includes, and the "specs" are defined like
<script type="text/javascript" src="spec/Projection.spec.js"></script>
Finally, run-jasmine.js is used to check the results of the jasmine tests (it is
run via phantomjs in the travis-CI script). It is a special version for the most
recent version of jasmine (2.4)
https://gist.github.com/vmeln/b6cbb319d9a0efc816be