Supported Libraries

Venus.js is designed to work with multiple testing libraries. Out of the box, Venus.js supports:

When writing a test, use the @venus-library annotation to indicate which testing library you wish to use (see Annotations).

Here is the same test written with Mocha, Jasmine, and QUnit.

Mocha

Mocha is unique in that you can use your choice of assertion libraries. By default, Venus ships with the expect.js assertion library for use with Mocha.

/**
 * @venus-library mocha
 * @venus-include ../src/Greeter.js
 */

describe('Greeter', function () {

  it('.talk() should format string', function() {
    var greet  = new Greeter(),
        result = greet.talk('Hello %s, how are you doing this fine %s?', 'Seth', 'Thursday');

    expect(result).to.be('Hello Seth, how are you doing this fine Thursday?');
  });

});

Jasmine

/**
 * @venus-library jasmine
 * @venus-include ../src/Greeter.js
 */

describe('Greeter', function () {

  it('.talk() should format string', function() {
    var greet  = new Greeter(),
        result = greet.talk('Hello %s, how are you doing this fine %s?', 'Seth', 'Thursday');

    expect(result).toBe('Hello Seth, how are you doing this fine Thursday?');
  });

});

QUnit

/**
 * @venus-library qunit
 * @venus-include ../src/Greeter.js
 */

test('Greeter', function () {
  var greet  = new Greeter(),
      result = greet.talk('Hello %s, how are you doing this fine %s?', 'Seth', 'Thursday');

  equal(result, 'Hello Seth, how are you doing this fine Thursday?', 'Greeter.talk() formats the string correctly');
});