Closed MParrao closed 5 years ago
We primarily use this module as part of the node-red repo and testing the nodes inside it. This means it makes certain assumptions about where the node-red source code is located.
It would help if you can describe your setup a bit; how/where is node-red installed, how are you using this module etc. Is there a public repo containing your node we could look at to try reproducing?
The node I'm using is the ones from the examples on the node-red site (lower-case) node, and the unit test just test loading the node. With node-red 0.19.6 works perfectly with 0.20.0 is having this problem with dependency alocation. Below is the test:
var helper = require("node-red-node-test-helper");
var lowerNode = require("../lower-case.js");
helper.init(require.resolve('node-red'));
describe('singleLoad', function () {
beforeEach(function (done) {
helper.startServer(done);
});
afterEach(function (done) {
helper.unload();
helper.stopServer(done);
});
it('should be loaded', function (done) {
var flow = [{ id: "n1", type: "lower-case", name: "lower-case" }];
helper.load(lowerNode, flow, function () {
var n1 = helper.getNode("n1");
n1.should.have.property('name', 'lower-case');
done();
});
});
});
Version 0.2.1 published to npm with the fix
Hi @knolleary thanks! but I'm still seeing problems, seems that the test-helper is still looking for the dependencies (@ node-red) on
node-red\lib instead of node-red\node-modules
Same lower case node is giving now this exception:
Error: Cannot find the NR source tree. Please raise an issue against node-red/node-red-node-test-helper with full details.
at NodeTestHelper._initRuntime (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:104:31)
at NodeTestHelper.init (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:128:18)
at new NodeTestHelper (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:78:14)
at Object.<anonymous> (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:295:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Manuel\eclipse-workspace\lower-case\test\singleLoad.js:1:76)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:324:14)
at Mocha.run (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:801:10)
at Object.exports.singleRun (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:207:16)
at exports.runMocha (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run.js:296:3)
at Object.runCommand (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\lib\command.js:238:44)
at Object.parseArgs [as _parseArgs] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:1072:28)
at Object.parse (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
at Object.exports.main (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\cli.js:62:6)
at Object.<anonymous> (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\bin\_mocha:10:23)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
What version of npm are you using?
Can you provide the full path of where the node-red module is installed?
Can you provide the full path of where the @node-red/runtime module is?
Hi please see below:
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64>npm list -dept=0
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64
+-- mocha@6.0.2
+-- node-red@0.20.3
+-- node-red-node-test-helper@0.2.1
`-- npm@6.4.1
node-red full path:
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red
@nodered/runtime path:
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red\node_modules\@node-red\runtime
Containing:
-lib
-locales
-LICENSE
-package.json
-Readme.md
This is on a Win10x64 OS. THANKS!
And what npm version?
The npm -ls command on the previous comment showed the one below, should I look for it on a different way?
`-- npm@6.4.1
Should I looked on a different way?
Sorry, I missed that bit in your reply.
Could you edit node-red-node-test-helper/index.js
and add after line 87:
console.log(prefix);
And share the output? Need to figure out why the path is showing up differently for you.
Sure here it goes, first line before the error message is the output of "prefix"
C:\Users\Manuel\Documents\lower-case\test>mocha singleLoad.js
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red\lib
Error: Cannot find the NR source tree. Please raise an issue against node-red/node-red-node-test-helper with full details.
at NodeTestHelper._initRuntime (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:105:31)
at NodeTestHelper.init (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:129:18)
at new NodeTestHelper (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:78:14)
at Object.<anonymous> (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:296:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Manuel\Documents\lower-case\test\singleLoad.js:1:76)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:324:14)
at Mocha.run (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:801:10)
at Object.exports.singleRun (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:207:16)
at exports.runMocha (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run.js:296:3)
at Object.runCommand (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\lib\command.js:238:44)
at Object.parseArgs [as _parseArgs] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:1072:28)
at Object.parse (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
at Object.exports.main (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\cli.js:62:6)
at Object.<anonymous> (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\bin\_mocha:10:23)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red\lib
Error: Cannot find the NR source tree. Please raise an issue against node-red/node-red-node-test-helper with full details.
at NodeTestHelper._initRuntime (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:105:31)
at NodeTestHelper.init (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\node-red-node-test-helper\index.js:129:18)
at Object.<anonymous> (C:\Users\Manuel\Documents\lower-case\test\singleLoad.js:4:8)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:324:14)
at Mocha.run (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\mocha.js:801:10)
at Object.exports.singleRun (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:207:16)
at exports.runMocha (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\run.js:296:3)
at Object.runCommand (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\lib\command.js:238:44)
at Object.parseArgs [as _parseArgs] (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:1072:28)
at Object.parse (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\node_modules\yargs\yargs.js:566:25)
at Object.exports.main (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\lib\cli\cli.js:62:6)
at Object.<anonymous> (C:\Eclipses\eclipse-javascript-photon-R-win32-x86_64\eclipse\runtimes\node-v8.12.0-win-x64\node_modules\mocha\bin\_mocha:10:23)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
0.2.2 published to npm - should resolve this...
Thanks!
The latest release for managing node-red 0.20.0 is looking for : ...\node-v8.12.0-win-x64\node_modules\ node-red\lib \@node-red\runtime\lib\nodes
Which does not exist, I found a similar path on the following ...\node-v8.12.0-win-x64\node_modules\ node-red\node_modules \@node-red\runtime\lib\nodes
Full stack trace below: