Skip to content

Commit 508b795

Browse files
authored
Merge pull request #11 from mblackstock/master
add back credentials, update readme
2 parents c8b1c6f + 410f2b9 commit 508b795

File tree

5 files changed

+962
-1
lines changed

5 files changed

+962
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ This will add the helper module to your `package.json` file:
2121
...
2222
```
2323

24+
## Using a local Node-RED install for tests
25+
26+
If you already have Node-RED installed for development, you can create a symbolic link to your local installation. For example, if Node-RED is cloned in your `~/projects` folder use:
27+
28+
npm install ~/projects/node-red --no-save
29+
2430
## Adding test script to `package.json`
2531

2632
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:

index.js

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var comms;
3131
var log;
3232
var context;
3333
var events;
34+
var credentials;
3435

3536
var runtimePath;
3637
var package = readPkgUp.sync();
@@ -60,6 +61,8 @@ function initRuntime(requirePath) {
6061
var prefix = requirePath.substring(0, requirePath.indexOf('/red.js'));
6162
context = require(prefix+"/runtime/nodes/context");
6263
comms = require(prefix+"/api/editor/comms");
64+
credentials = require(prefix+"/runtime/nodes/credentials");
65+
6366
} catch (err) {
6467
// ignore, assume init will be called again by a test script supplying the runtime path
6568
}
@@ -150,6 +153,8 @@ module.exports = {
150153
return redNodes.getNode(id);
151154
},
152155

156+
credentials: credentials,
157+
153158
clearFlows: function() {
154159
return redNodes.stopFlows();
155160
},

0 commit comments

Comments
 (0)