Works well with generator-webapp.
npm install -g generator-mocha-testem
What this does:
testdirectory (similar to generator-mocha's, but modified to work through the Testem server)
testem, and it should launch some browsers and run your tests.
mkdir myproject && cd myproject
rm -rf test
You can now run
grunt server at the same time in different terminals, and you'll have a live-reloading webapp and live-reloading test results at the same time.
In your spec runner (
test/index.html), add your script tags in this form:
Follow these instructions to use Testem in CI mode during your build process. It launches each browser in turn, runs your tests, and closes them afterwards, then proceeds to the next step (e.g. build) only if everything was green.
npm uninstall -D grunt-mocha
npm install -D grunt-testem
mocha, and remove the
grunt.registerTask('test'..., remove the
connect:testsubtask, and change
testem:main:src: 'testem.json'dest: 'tests.tap'
Now try running
grunt test (or just
You can configure which browsers it launches by editing the
launch_in_ci section in
(Not yet tested.)
grunt server in a webapp project, CoffeeScripts are compiled to
.tmp. So if you want to unit-test a
*.coffee file, the script tag in your
test/index.html will need to look like this:
(I haven't yet looked into using CoffeeScript for test files yet. More steps will be needed. Suggestions/PRs welcome.)
See the contributing docs