Using Canary

Canary's API is the interface used to write and to run automated JavaScript tests. It is built on the CanaryTest class and on the global instance of this class acquired by importing the Canary package. By convention, this global instance should be referred to as canary.

const canary = require("canary-test");

The Test Class

The CanaryTest class can be referred to via canary.Test. Although most of the work done with Canary will be using the methods of instances of this class, it should not normally be necessary to instantiate a CanaryTest yourself.

assert(canary instanceof canary.Test);

There are also functions available for creating disconnected test groups and series in a similar way:

const someGroup = canary.Group("Some group");
assert(someGroup.isGroup);
const someSeries = canary.Series("Some series");
assert(someSeries.isSeries);

The library also utilizes CanaryTestCallback and CanaryTestError classes. These classes can be referred to with canary.Callback and canary.Error, respectively. These classes are mainly for internal use and, normally, it will not be necessary to work with them directly.

List of Attributes

Here is an exhaustive list of documented CanaryTest methods and other attributes. Attributes not documented here are liable to change often and without notice; it is not recommended to rely on undocumented implementation details.