hi guys,
I've node-red installed globally and from my custom node project i've installed
npm install node-red-node-test-helper node-red --save-dev
test fail when i run npm test from my custom node project.
should be loaded:
TypeError: Cannot read property 'should' of null
this is my test file
var should = require("should");
var helper = require("node-red-node-test-helper");
var mycsnode = require("../mycustom");
helper.init(require.resolve('node-red'));
describe('mycsnode Node', function () {
beforeEach(function (done) {
helper.startServer(done);
});
afterEach(function (done) {
helper.unload().then(function() {
helper.stopServer(done);
});
});
it('should be loaded', function (done) {
var flow = [{ id: "n1", type: "mycsnode", name: "test name" }];
helper.load(mycsnode, flow, function () {
var n1 = helper.getNode("n1");
console.log('n1---', n1);
try {
n1.should.have.property('name', 'test name');
done();
} catch(err) {
done(err);
}
});
});
});