Grunt plugin runs Mocha tests in a (nearly) headless Mozilla Firefox browser-engine via SlimerJS
Some internal parts sourced from grunt-mocha by @kmiyashiro.
⚠️ Very early version, user beware.
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
$ npm install grunt-mocha-slimer --save-dev
For an example html see the ./test folder.
gruntinitConfigmocha_slimerjs:all:options:ui: 'bdd'reporter: 'Spec'run: truesrc: 'test/index.html';
gruntinitConfigmocha_slimerjs:all:options:ui: 'bdd'reporter: 'Spec'grep: 'some keyword'// SlimerJS timeouttimeout: 10000// set to false and call it later for async tests (AMD etc)run: false// run SlimerJS via 'xvfb-run': for true headless testing// must be true on Travis-CI, use: (process.env.TRAVIS === 'true')xvfb: true// pass http urls (use grunt-contrib-connect etc)urls: '';
Better docs at a later date.
canvaslibraries on a generic node.js based CI like Travis.
grunt-mocha-slimerseems slightly faster then
grunt-mochaas all tests are in one process (not sure why grunt-mocha doesn't do that, we'll see).
This is the nature of SlimerJS and the engine it runs, as . On Linux and OSX SlimerJS has support for
xvfb if you have it installed. For more info see the SlimerJS documentantion.
You can enable this by setting
xvfb: true (you need this for Travis-CI, see below).
Wisdom says no, adventure and necessity say.. give it a try. It is the simplest way to do all the mocha-flavoured things you cannot do in PhantomJS's crappy archaic Webkit.
I needed it for some OSS projects and it seems to work (well, at least it properly fails if assertions fail).
Contributions are very welcome, please create an Issue before doing something major.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014 Bart van der Schoor
Licensed under the MIT license.