You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+24-17
Original file line number
Diff line number
Diff line change
@@ -20,33 +20,40 @@ This will add the helper module to your `package.json` file as a development dep
20
20
...
21
21
```
22
22
23
+
The test-helper requires the node-red runtime to run its tests, but Node-RED is **not** installed as a dependency. The reason for this is that test-helper is (or will be) used in Node-RED core tests, and Node-RED itself has a large number of dependencies that you may not want to download if you already have it installed.
24
+
25
+
You can install the Node-RED runtime available for your unit tests one of two ways:
26
+
27
+
1. as a dependency in your project:
28
+
29
+
```
30
+
npm install node-red
31
+
```
32
+
33
+
2. or link to Node-RED installed globally (recommended) using:
34
+
35
+
```
36
+
npm install -g node-red
37
+
npm link node-red
38
+
```
39
+
23
40
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.
24
41
25
-
## Alternate linking of node project dependencies
42
+
## Linking to additional test dependencies
43
+
44
+
To reduce disk use further, you can install the test-helper and additional dev dependencies globally and then link them to your node project. This may be a better option especially if you are developing more than one node.
26
45
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.
46
+
See the `package.json` file for the additional dependencies used by test-helper.
28
47
29
-
Install the unit test packages globally as follows:
48
+
For example to install express globally:
30
49
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
50
npm install -g express
38
51
39
-
In your node project development directory, link the unit test packages as follows:
52
+
Then link to it in your project:
40
53
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
54
npm link express
48
55
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.
56
+
Depending on the nodes in your test flow, you may also want to link to other global packages. 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.
0 commit comments