QUnit CLIB v1.0.0

command-line interface boilerplate

QUnit CLIB helps extend QUnit’s CLI support to many common CLI environments.

Screenshot

QUnit CLIB brings QUnit to your favorite shell.

Support

QUnit CLIB has been tested in at least Node.js 0.4.8-0.8.6, Narwhal v0.3.2, RingoJS v0.8.0, and Rhino v1.7RC3-RC5.

Usage

  1. (function(window) {
  2. // use a single load function
  3. var load = typeof require == 'function' ? require : window.load;
  4. // load QUnit and CLIB if needed
  5. var QUnit =
  6. window.QUnit || (
  7. window.setTimeout || (window.addEventListener = window.setTimeout = / /),
  8. window.QUnit = load('path/to/qunit.js') || window.QUnit,
  9. load('path/to/qunit-clib.js'),
  10. (window.addEventListener || 0).test && delete window.addEventListener,
  11. window.QUnit
  12. );
  13. // explicitly call `QUnit.module()` instead of `module()`
  14. // in case we are in a CLI environment
  15. QUnit.module('A Test Module');
  16. test('A Test', function() {
  17. // ...
  18. });
  19. // must call `QUnit.start()` if using QUnit < 1.3.0 with Node.js or any
  20. // version of QUnit with Narwhal, Rhino, or RingoJS
  21. if (!window.document) {
  22. QUnit.start();
  23. }
  24. }(typeof global == 'object' && global || this));

Footnotes

  1. QUnit v1.3.0 does not work with Narwhal or Ringo < v0.8.0

  2. Rhino v1.7RC4 does not support timeout fallbacks clearTimeout and setTimeout

Author