QUnit plugin for running module setup and teardown once
QUnit plugin that adds setupOne and teardownOnce to modules
QUnitmodule'Example'// runs once before anything else in the module// runs before each unit test// runs after EACH unit test in this module// runs once after all unit tests finished (including teardown);
Include qunit-once.js after qunit.js in HTML
Or install qunit-once via
npm install qunit-once --save-dev under node.
// tests.jsvar counter = 0;QUnitmodule'Example'counter = 1;counter += 1;;QUnittest'first'QUnitequalcounter 2 'setupOnce followed by setup';counter = 0;;QUnittest'second'QUnitequalcounter 1 'first test followed by setup';;
npm install -g qunitqunit -d qunit-once.js -c tests.js -t tests.js
You don't need to include this module when running with gt, it already supports setupOnce and teardownOnce methods.
Author: Gleb Bahmutov © 2013 @bahmutov
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github