Skip to content

Commit

Permalink
Merge pull request #11 from mblackstock/master
Browse files Browse the repository at this point in the history
add back credentials, update readme
  • Loading branch information
mblackstock authored May 4, 2018
2 parents c8b1c6f + 410f2b9 commit 508b795
Show file tree
Hide file tree
Showing 5 changed files with 962 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ This will add the helper module to your `package.json` file:
...
```

## Using a local Node-RED install for tests

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:

npm install ~/projects/node-red --no-save

## Adding test script to `package.json`

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:
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var comms;
var log;
var context;
var events;
var credentials;

var runtimePath;
var package = readPkgUp.sync();
Expand Down Expand Up @@ -60,6 +61,8 @@ function initRuntime(requirePath) {
var prefix = requirePath.substring(0, requirePath.indexOf('/red.js'));
context = require(prefix+"/runtime/nodes/context");
comms = require(prefix+"/api/editor/comms");
credentials = require(prefix+"/runtime/nodes/credentials");

} catch (err) {
// ignore, assume init will be called again by a test script supplying the runtime path
}
Expand Down Expand Up @@ -150,6 +153,8 @@ module.exports = {
return redNodes.getNode(id);
},

credentials: credentials,

clearFlows: function() {
return redNodes.stopFlows();
},
Expand Down
Loading

0 comments on commit 508b795

Please sign in to comment.