Skip to content

Commit 46a54fe

Browse files
committed
add section on global linking dev dependencies
1 parent ba4b72c commit 46a54fe

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ This will add the helper module to your `package.json` file as a development dep
2222

2323
Both [Mocha](https://mochajs.org/) and [Should](https://shouldjs.github.io/) will be pulled in with the test helper. Mocha is a unit test framework for Javascript; Should is an assertion library. For more information on these frameworks, see their associated documentation.
2424

25+
## Alternate linking of node project dependencies
26+
27+
Because test-helper depends on Node-RED and express, installing test-helper as a dev dependency to your node project can pull in a large number of packages. To reduce the space on disk you can install your dev dependencies globally and then link them to your node project. This is a better option especially if you are developing more than one node.
28+
29+
Install the unit test packages globally as follows:
30+
31+
npm install -g node-red
32+
npm install -g node-red-node-test-helper
33+
npm install -g should
34+
npm install -g mocha
35+
npm install -g sinon
36+
npm install -g supertest
37+
npm install -g express
38+
39+
In your node project development directory, link the unit test packages as follows:
40+
41+
npm link node-red
42+
npm link node-red-node-test-helper
43+
npm link should
44+
npm link mocha
45+
npm link sinon
46+
npm link supertest
47+
npm link express
48+
49+
Depending on the nodes in your test flow, you may also need to link in other packages as required. If a test indicates that a package cannot be found, and you expect to need it for testing other nodes, consider installing the package globally and then linking it to your node project the same way.
50+
2551
## Adding test script to `package.json`
2652

2753
To run your tests you can add a test script to your `package.json` file in the `scripts` section. To run all of the files with the `_spec.js` prefix in the test directory for example:

0 commit comments

Comments
 (0)