improve tests for nodeDir

Adds new resources (loose files, non NR pkgs, NR modules, NR Plugins)
Adds new tests
#getNodeFiles - new tests below
  √ Finds nodes and icons only in nodesDir with files, icons and valid node-red packages
  √ Should not find node-red node in nodesDir with files, icons and valid node-red packages
  √ Should not find node-red node in nodesDir when regular package and valid node-red packages
#getModuleFiles - new tests below
  √ gets a nodes module files
  √ Finds only 1 node-red node in nodesDir amongst legacy nodes and regular nodes
  √ Finds a node-red node in nodesDir with a sub dir containing valid node-red package
  √ Finds 2 node-red node and 1 plugin in nodesDir (in root of dir)
  √ Finds 2 node-red node and 1 plugin in nodesDir pointing to a node_modules dir
This commit is contained in:
Steve-Mcl
2022-06-16 11:00:31 +01:00
parent ba22b07dce
commit 98ebb02763
34 changed files with 441 additions and 49 deletions

View File

@@ -0,0 +1 @@
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M10.004 14.499h20M10.004 46.503h20M10.004 22.5h20M10.004 30.501h20M10.004 38.502h20" stroke="#fff" stroke-width="2.9997000000000003"/></svg>

After

Width:  |  Height:  |  Size: 236 B

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from loose1.html")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from loose1.js")
})()

View File

@@ -0,0 +1 @@
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M30.999 31.005v-3h-6.762s.812-12.397 1.162-14 .597-3.35 2.628-3.103 1.971 3.103 1.971 3.103l4.862-.016s-.783-3.984-2.783-5.984-7.946-1.7-9.633.03c-1.687 1.73-2.302 5.065-2.597 6.422-.588 4.5-.854 9.027-1.248 13.547h-8.6v3H18.1s-.812 12.398-1.162 14-.597 3.35-2.628 3.103-1.972-3.102-1.972-3.102l-4.862.015s.783 3.985 2.783 5.985c2 2 7.946 1.699 9.634-.031 1.687-1.73 2.302-5.065 2.597-6.422.587-4.5.854-9.027 1.248-13.547z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 539 B

View File

@@ -0,0 +1 @@
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M7 38.98v3.983h11v12l13-23H19l-.463.017c-1.28 4.048-5.066 6.983-9.537 6.983zm12-11.017h12l-13-23v12H7V20.9l2 .064c4.467 0 8.25 2.93 9.534 6.972zM6.95 24.22a6 6 0 1 1-.083 11.456" fill="#fff" style="isolation:auto;mix-blend-mode:normal"/></svg>

After

Width:  |  Height:  |  Size: 339 B

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from loose2.html")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from loose2.js")
})()

View File

@@ -0,0 +1 @@
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M30.999 31.005v-3h-6.762s.812-12.397 1.162-14 .597-3.35 2.628-3.103 1.971 3.103 1.971 3.103l4.862-.016s-.783-3.984-2.783-5.984-7.946-1.7-9.633.03c-1.687 1.73-2.302 5.065-2.597 6.422-.588 4.5-.854 9.027-1.248 13.547h-8.6v3H18.1s-.812 12.398-1.162 14-.597 3.35-2.628 3.103-1.972-3.102-1.972-3.102l-4.862.015s.783 3.985 2.783 5.985c2 2 7.946 1.699 9.634-.031 1.687-1.73 2.302-5.065 2.597-6.422.587-4.5.854-9.027 1.248-13.547z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 539 B

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from regular module main.js")
})()

View File

@@ -0,0 +1,19 @@
{
"name": "node-red-node-testnode",
"version": "1.0.0",
"description": "A node-red node that does nothing other than exist",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"node-red"
],
"node-red": {
"nodes": {
"testnode": "index.js"
}
},
"author": "@testyMcTersterson",
"license": "MIT"
}

View File

@@ -0,0 +1 @@
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M30.999 31.005v-3h-6.762s.812-12.397 1.162-14 .597-3.35 2.628-3.103 1.971 3.103 1.971 3.103l4.862-.016s-.783-3.984-2.783-5.984-7.946-1.7-9.633.03c-1.687 1.73-2.302 5.065-2.597 6.422-.588 4.5-.854 9.027-1.248 13.547h-8.6v3H18.1s-.812 12.398-1.162 14-.597 3.35-2.628 3.103-1.972-3.102-1.972-3.102l-4.862.015s.783 3.985 2.783 5.985c2 2 7.946 1.699 9.634-.031 1.687-1.73 2.302-5.065 2.597-6.422.587-4.5.854-9.027 1.248-13.547z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 539 B

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from regular module main.js")
})()

View File

@@ -0,0 +1,14 @@
{
"name": "regular_node",
"version": "1.0.0",
"description": "A regular node that does nothing other than exist",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"test"
],
"author": "@testyMcTersterson",
"license": "MIT"
}

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from @test/testnode index.html")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from @test/testnode index.js")
})()

View File

@@ -0,0 +1,20 @@
{
"name": "@test/testnode",
"version": "1.0.0",
"description": "A test node that does nothing other than exist",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"node-red",
"test"
],
"node-red": {
"nodes": {
"testnode": "index.js"
}
},
"author": "@testyMcTersterson",
"license": "MIT"
}

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from testnode2 index.js")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from testnode2 index.js")
})()

View File

@@ -0,0 +1,20 @@
{
"name": "testnode2",
"version": "1.0.0",
"description": "A test node that does nothing other than exist",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"node-red",
"test"
],
"node-red": {
"nodes": {
"testnode2": "index.js"
}
},
"author": "@testyMcTersterson",
"license": "MIT"
}

View File

@@ -0,0 +1,3 @@
(function() {
console.log("Hi from test plugin client side")
})()

View File

@@ -0,0 +1,14 @@
module.exports = function (RED) {
RED.plugins.registerPlugin('test-theme', {
type: 'node-red-theme',
scripts: [
'files/clientside.js'
],
css: [
'files/theme.css',
],
monacoOptions: {
theme: "vs"
}
})
}

View File

@@ -0,0 +1 @@
:root{--red-ui-primary-background: #f2f3fb;}

View File

@@ -0,0 +1,24 @@
{
"name": "test-theme2",
"version": "0.0.1",
"description": "test theme for Node-RED",
"keywords": [
"node-red",
"plugin",
"theme"
],
"author": {
"name": "testy-McTesterson"
},
"license": "MIT",
"node-red": {
"version": ">=2.2.0",
"plugins": {
"test-theme2": "files/plugin.js"
}
},
"engines": {
"node": ">=12.x"
}
}

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from @test/testnode index.html")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from @test/testnode index.js")
})()

View File

@@ -0,0 +1,20 @@
{
"name": "@test/testnode",
"version": "1.0.0",
"description": "A test node that does nothing other than exist",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"node-red",
"test"
],
"node-red": {
"nodes": {
"testnode": "index.js"
}
},
"author": "@testyMcTersterson",
"license": "MIT"
}

View File

@@ -0,0 +1,3 @@
(function() {
console.log("Hi from test plugin client side")
})()

View File

@@ -0,0 +1,14 @@
module.exports = function (RED) {
RED.plugins.registerPlugin('test-theme', {
type: 'node-red-theme',
scripts: [
'files/clientside.js'
],
css: [
'files/theme.css',
],
monacoOptions: {
theme: "vs"
}
})
}

View File

@@ -0,0 +1 @@
:root{--red-ui-primary-background: #f2f3fb;}

View File

@@ -0,0 +1,24 @@
{
"name": "@test/test-theme3",
"version": "0.0.1",
"description": "test theme for Node-RED",
"keywords": [
"node-red",
"plugin",
"theme"
],
"author": {
"name": "testy-McTesterson"
},
"license": "MIT",
"node-red": {
"version": ">=2.2.0",
"plugins": {
"test-theme3": "files/plugin.js"
}
},
"engines": {
"node": ">=12.x"
}
}

View File

@@ -0,0 +1,5 @@
<script>
(function() {
console.log("hello from testnode3 index.js")
})()
</script>

View File

@@ -0,0 +1,4 @@
(function() {
console.log("hello from testnode3 index.js")
})()

View File

@@ -0,0 +1,20 @@
{
"name": "testnode3",
"version": "1.0.0",
"description": "A test node that does nothing other than exist",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"node-red",
"test"
],
"node-red": {
"nodes": {
"testnode3": "index.js"
}
},
"author": "@testyMcTersterson",
"license": "MIT"
}