Error getting started testing a custom node

I'm trying to just get started building a node with the instructions here:

I'm getting this error trying to run the mocha _spec file:

mocha test/lower-case_spec.js

  lower-case Node
    1) should be loaded
    2) "after each" hook for "should be loaded"

  0 passing (7ms)
  2 failing

  1) lower-case Node
       should be loaded:
     TypeError: Cannot read property 'log' of undefined
      at Function.spy (node_modules/sinon/lib/sinon/spy.js:156:61)
      at Sandbox.spy (node_modules/sinon/lib/sinon/sandbox.js:328:35)
      at NodeTestHelper.load (node_modules/node-red-node-test-helper/index.js:178:53)
      at Context.<anonymous> (test/lower-case_spec.js:12:16)

  2) lower-case Node
       "after each" hook for "should be loaded":
     TypeError: Cannot read property 'clearRegistry' of undefined
      at NodeTestHelper.unload (node_modules/node-red-node-test-helper/index.js:283:24)
      at Context.<anonymous> (test/lower-case_spec.js:7:16)

I've got the library in my package.json:

  "devDependencies": {
    "node-red-node-test-helper": "^0.2.7"

I'm new to NodeJS development so I'm sure there's something obvious I'm messing up.

If anyone else runs into this, I needed to add node-red to my devDependencies too:

"node-red": "^1.3.2"

That should probably be a dependency of the node-red-node-test-helper if it's required

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.