F.attach()

  • function
FuncUnit.attach  

attach(runner)

Attach a test runner, either QUnit, Mocha, or Jasmine to FuncUnit which will be used to pause, resume, and make assertions.

var QUnit = require("qunit");
F.attach(QUnit);

Parameters

  1. runner {Object}

    A test runner to attach to FuncUnit.

Use

By default FuncUnit does not control the test runner or make assertions. This is left up to you. So for example if you're using QUnit you might write a test like:

var QUnit = require("qunit");
var F = require("funcunit");

test("a test", function(){
  stop();
  F("#clickme").click(function(){
        ok("You were clicked!"); 
        start();
  });
});

You can prevent this extra boilerplate by attaching a test runner.

var QUnit = require("qunit");
var F = require("funcunit");

F.attach(QUnit);

test("a test", function(){
  F("#clickme").click();
});

F.attach() works with QUnit, Jasmine, and Mocha.