Alon Alon - 1 year ago 172
Node.js Question

Chai should is undefined

I have installed Mocha as well as Chai.

In my unit test:

import {expect, should} from "chai";

describe("array", function () {
it("has length of 1", function (done) {
var arr = ["B"];

works as expected, but
is undefined.


Answer Source

You should call chai.should() at the begin of the file to use should style.

It will extends each object with a should property to start your assertions chain.

You can find more usage examples in chai documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download