beginner unit testing, using the mocha framework, report an error when using the-- growl parameter
there are two test methods, as follows:
add.js
function add(x, y) {
return x + y;
}
module.exports = add;
multiply.js
function multiply(x, y) {
return x * y;
}
module.exports = multiply;
two test suites, as follows:
add.test.js
var add = require("../src/add.js");
var expect = require("chai").expect;
describe("", function() {
it("1 1 2", function() {
expect(add(1, 1)).to.be.equal(2);
});
it("0", function() {
expect(add(1, 0)).to.be.equal(1);
});
});
multiply.test.js
var multiply = require("../../src/multiply");
var expect = require("chai").expect;
describe("", function() {
it("1 1 1", function() {
expect(multiply(1, 1)).to.be.equal(1);
});
})
demo directory relationship, as shown below:
:mocha --recursive --reporter tap --growl
:
:
because of the first contact with unit testing, and also the first contact with the testing framework of mocha, I am not very good at mastering some things, and I can"t find a similar problem solution on the Internet. I also hope that the kind-hearted Daniel can help correct the mistake!