node-red-node-test-helper
Advanced tools
Comparing version 0.2.5 to 0.2.6
36
index.js
@@ -60,2 +60,7 @@ /** | ||
} | ||
// case 4: NR & NRNTH are git repos sat alongside each other | ||
try { | ||
const nrpkg = require("../node-red/package.json"); | ||
return "../node-red/packages/node_modules/node-red" | ||
} catch(ignored) {} | ||
} | ||
@@ -126,2 +131,10 @@ | ||
this._events = RED.runtime.events; | ||
this._nodeModules = { | ||
'catch': require(path.join(prefix, '@node-red/nodes/core/common/25-catch.js')), | ||
'status': require(path.join(prefix, '@node-red/nodes/core/common/25-status.js')), | ||
'complete': require(path.join(prefix, '@node-red/nodes/core/common/24-complete.js')) | ||
} | ||
} | ||
@@ -245,9 +258,20 @@ } catch (ignored) { | ||
if (Array.isArray(testNode)) { | ||
testNode.forEach(fn => { | ||
let preloadedCoreModules = new Set(); | ||
testFlow.forEach(n => { | ||
if (this._nodeModules.hasOwnProperty(n.type)) { | ||
// Go find the 'real' core node module and load it... | ||
this._nodeModules[n.type](red); | ||
preloadedCoreModules.add(this._nodeModules[n.type]); | ||
} | ||
}) | ||
if (!Array.isArray(testNode)) { | ||
testNode = [testNode]; | ||
} | ||
testNode.forEach(fn => { | ||
if (!preloadedCoreModules.has(fn)) { | ||
fn(red); | ||
}); | ||
} else { | ||
testNode(red); | ||
} | ||
} | ||
}); | ||
return redNodes.loadFlows() | ||
@@ -254,0 +278,0 @@ .then(() => { |
{ | ||
"name": "node-red-node-test-helper", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "A test framework for Node-RED nodes", | ||
@@ -19,6 +19,6 @@ "main": "index.js", | ||
"read-pkg-up": "7.0.1", | ||
"semver": "7.3.2", | ||
"semver": "7.3.4", | ||
"should": "^13.2.3", | ||
"should-sinon": "0.0.6", | ||
"sinon": "9.0.2", | ||
"sinon": "9.2.4", | ||
"stoppable": "1.1.0", | ||
@@ -25,0 +25,0 @@ "supertest": "4.0.2" |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
78174
1270
18
+ Addedlru-cache@6.0.0(transitive)
+ Addedsemver@7.3.4(transitive)
+ Addedsinon@9.2.4(transitive)
+ Addedyallist@4.0.0(transitive)
- Removed@sinonjs/formatio@5.0.1(transitive)
- Removedsemver@7.3.2(transitive)
- Removedsinon@9.0.2(transitive)
Updatedsemver@7.3.4
Updatedsinon@9.2.4