# Error getting started testing a custom node

**URL:** https://discourse.nodered.org/t/error-getting-started-testing-a-custom-node/44322
**Category:** Developing Nodes
**Created:** [17 April 2021 14:31 UTC](https://discourse.nodered.org/t/error-getting-started-testing-a-custom-node/44322 "2021-04-17T14:31:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jcarreira](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jcarreira/32/39830_2.png) [@jcarreira](https://discourse.nodered.org/u/jcarreira)
#### Post date: [17 April 2021 14:31 UTC](https://discourse.nodered.org/t/error-getting-started-testing-a-custom-node/44322/1 "2021-04-17T14:31:16Z")

</div>

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

[https://nodered.org/docs/creating-nodes/first-node](https://nodered.org/docs/creating-nodes/first-node)

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

```auto
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:

```auto

  "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.

---

<div class="post-metadata">

### Author: ![jcarreira](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jcarreira/32/39830_2.png) [@jcarreira](https://discourse.nodered.org/u/jcarreira)
#### Post date: [18 April 2021 14:28 UTC](https://discourse.nodered.org/t/error-getting-started-testing-a-custom-node/44322/2 "2021-04-18T14:28:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 June 2021 14:29 UTC](https://discourse.nodered.org/t/error-getting-started-testing-a-custom-node/44322/3 "2021-06-17T14:29:24Z")

</div>

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