diff --git a/.gitignore b/.gitignore index d0c801b5f..d22f0266b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ locales/zz-ZZ nodes/core/locales/zz-ZZ !packages/node_modules packages/node_modules/@node-red/editor-client/public +!test/**/node_modules diff --git a/packages/node_modules/node-red/red/red.js b/packages/node_modules/node-red/lib/red.js similarity index 100% rename from packages/node_modules/node-red/red/red.js rename to packages/node_modules/node-red/lib/red.js diff --git a/packages/node_modules/node-red/red.js b/packages/node_modules/node-red/red.js index 970a1cb92..19a4284ac 100755 --- a/packages/node_modules/node-red/red.js +++ b/packages/node_modules/node-red/red.js @@ -24,7 +24,7 @@ catch(e) { bcrypt = require('bcryptjs'); } var nopt = require("nopt"); var path = require("path"); var fs = require("fs-extra"); -var RED = require("./red/red.js"); +var RED = require("./lib/red.js"); var server; var app = express(); diff --git a/test/red/api/admin/context_spec.js b/test/unit/@node-red/editor-api/lib/admin/context_spec.js similarity index 100% rename from test/red/api/admin/context_spec.js rename to test/unit/@node-red/editor-api/lib/admin/context_spec.js diff --git a/test/red/api/admin/flow_spec.js b/test/unit/@node-red/editor-api/lib/admin/flow_spec.js similarity index 100% rename from test/red/api/admin/flow_spec.js rename to test/unit/@node-red/editor-api/lib/admin/flow_spec.js diff --git a/test/red/api/admin/flows_spec.js b/test/unit/@node-red/editor-api/lib/admin/flows_spec.js similarity index 100% rename from test/red/api/admin/flows_spec.js rename to test/unit/@node-red/editor-api/lib/admin/flows_spec.js diff --git a/test/red/api/admin/index_spec.js b/test/unit/@node-red/editor-api/lib/admin/index_spec.js similarity index 100% rename from test/red/api/admin/index_spec.js rename to test/unit/@node-red/editor-api/lib/admin/index_spec.js diff --git a/test/red/api/admin/nodes_spec.js b/test/unit/@node-red/editor-api/lib/admin/nodes_spec.js similarity index 100% rename from test/red/api/admin/nodes_spec.js rename to test/unit/@node-red/editor-api/lib/admin/nodes_spec.js diff --git a/test/red/api/auth/clients_spec.js b/test/unit/@node-red/editor-api/lib/auth/clients_spec.js similarity index 100% rename from test/red/api/auth/clients_spec.js rename to test/unit/@node-red/editor-api/lib/auth/clients_spec.js diff --git a/test/red/api/auth/index_spec.js b/test/unit/@node-red/editor-api/lib/auth/index_spec.js similarity index 100% rename from test/red/api/auth/index_spec.js rename to test/unit/@node-red/editor-api/lib/auth/index_spec.js diff --git a/test/red/api/auth/permissions_spec.js b/test/unit/@node-red/editor-api/lib/auth/permissions_spec.js similarity index 100% rename from test/red/api/auth/permissions_spec.js rename to test/unit/@node-red/editor-api/lib/auth/permissions_spec.js diff --git a/test/red/api/auth/strategies_spec.js b/test/unit/@node-red/editor-api/lib/auth/strategies_spec.js similarity index 100% rename from test/red/api/auth/strategies_spec.js rename to test/unit/@node-red/editor-api/lib/auth/strategies_spec.js diff --git a/test/red/api/auth/tokens_spec.js b/test/unit/@node-red/editor-api/lib/auth/tokens_spec.js similarity index 100% rename from test/red/api/auth/tokens_spec.js rename to test/unit/@node-red/editor-api/lib/auth/tokens_spec.js diff --git a/test/red/api/auth/users_spec.js b/test/unit/@node-red/editor-api/lib/auth/users_spec.js similarity index 100% rename from test/red/api/auth/users_spec.js rename to test/unit/@node-red/editor-api/lib/auth/users_spec.js diff --git a/test/red/api/editor/comms_spec.js b/test/unit/@node-red/editor-api/lib/editor/comms_spec.js similarity index 100% rename from test/red/api/editor/comms_spec.js rename to test/unit/@node-red/editor-api/lib/editor/comms_spec.js diff --git a/test/red/api/editor/credentials_spec.js b/test/unit/@node-red/editor-api/lib/editor/credentials_spec.js similarity index 100% rename from test/red/api/editor/credentials_spec.js rename to test/unit/@node-red/editor-api/lib/editor/credentials_spec.js diff --git a/test/red/api/editor/index_spec.js b/test/unit/@node-red/editor-api/lib/editor/index_spec.js similarity index 100% rename from test/red/api/editor/index_spec.js rename to test/unit/@node-red/editor-api/lib/editor/index_spec.js diff --git a/test/red/api/editor/library_spec.js b/test/unit/@node-red/editor-api/lib/editor/library_spec.js similarity index 100% rename from test/red/api/editor/library_spec.js rename to test/unit/@node-red/editor-api/lib/editor/library_spec.js diff --git a/test/red/api/editor/locales_spec.js b/test/unit/@node-red/editor-api/lib/editor/locales_spec.js similarity index 100% rename from test/red/api/editor/locales_spec.js rename to test/unit/@node-red/editor-api/lib/editor/locales_spec.js diff --git a/test/red/api/editor/projects_spec.js b/test/unit/@node-red/editor-api/lib/editor/projects_spec.js similarity index 100% rename from test/red/api/editor/projects_spec.js rename to test/unit/@node-red/editor-api/lib/editor/projects_spec.js diff --git a/test/red/api/editor/settings_spec.js b/test/unit/@node-red/editor-api/lib/editor/settings_spec.js similarity index 100% rename from test/red/api/editor/settings_spec.js rename to test/unit/@node-red/editor-api/lib/editor/settings_spec.js diff --git a/test/red/api/editor/sshkeys_spec.js b/test/unit/@node-red/editor-api/lib/editor/sshkeys_spec.js similarity index 100% rename from test/red/api/editor/sshkeys_spec.js rename to test/unit/@node-red/editor-api/lib/editor/sshkeys_spec.js diff --git a/test/red/api/editor/theme_spec.js b/test/unit/@node-red/editor-api/lib/editor/theme_spec.js similarity index 100% rename from test/red/api/editor/theme_spec.js rename to test/unit/@node-red/editor-api/lib/editor/theme_spec.js diff --git a/test/red/api/editor/ui_spec.js b/test/unit/@node-red/editor-api/lib/editor/ui_spec.js similarity index 100% rename from test/red/api/editor/ui_spec.js rename to test/unit/@node-red/editor-api/lib/editor/ui_spec.js diff --git a/test/red/api/index_spec.js b/test/unit/@node-red/editor-api/lib/index_spec.js similarity index 100% rename from test/red/api/index_spec.js rename to test/unit/@node-red/editor-api/lib/index_spec.js diff --git a/test/red/api/util_spec.js b/test/unit/@node-red/editor-api/lib/util_spec.js similarity index 100% rename from test/red/api/util_spec.js rename to test/unit/@node-red/editor-api/lib/util_spec.js diff --git a/test/red/runtime-registry/deprecated_spec.js b/test/unit/@node-red/registry/lib/deprecated_spec.js similarity index 100% rename from test/red/runtime-registry/deprecated_spec.js rename to test/unit/@node-red/registry/lib/deprecated_spec.js diff --git a/test/red/runtime-registry/index_spec.js b/test/unit/@node-red/registry/lib/index_spec.js similarity index 100% rename from test/red/runtime-registry/index_spec.js rename to test/unit/@node-red/registry/lib/index_spec.js diff --git a/test/red/runtime-registry/installer_spec.js b/test/unit/@node-red/registry/lib/installer_spec.js similarity index 100% rename from test/red/runtime-registry/installer_spec.js rename to test/unit/@node-red/registry/lib/installer_spec.js diff --git a/test/red/runtime-registry/library_spec.js b/test/unit/@node-red/registry/lib/library_spec.js similarity index 100% rename from test/red/runtime-registry/library_spec.js rename to test/unit/@node-red/registry/lib/library_spec.js diff --git a/test/red/runtime-registry/loader_spec.js b/test/unit/@node-red/registry/lib/loader_spec.js similarity index 100% rename from test/red/runtime-registry/loader_spec.js rename to test/unit/@node-red/registry/lib/loader_spec.js diff --git a/test/red/runtime-registry/localfilesystem_spec.js b/test/unit/@node-red/registry/lib/localfilesystem_spec.js similarity index 100% rename from test/red/runtime-registry/localfilesystem_spec.js rename to test/unit/@node-red/registry/lib/localfilesystem_spec.js diff --git a/test/red/runtime-registry/registry_spec.js b/test/unit/@node-red/registry/lib/registry_spec.js similarity index 100% rename from test/red/runtime-registry/registry_spec.js rename to test/unit/@node-red/registry/lib/registry_spec.js diff --git a/test/red/runtime-registry/resources/examples/one.json b/test/unit/@node-red/registry/lib/resources/examples/one.json similarity index 100% rename from test/red/runtime-registry/resources/examples/one.json rename to test/unit/@node-red/registry/lib/resources/examples/one.json diff --git a/test/red/runtime-registry/resources/local/DuffNode/DuffNode.js b/test/unit/@node-red/registry/lib/resources/local/DuffNode/DuffNode.js similarity index 100% rename from test/red/runtime-registry/resources/local/DuffNode/DuffNode.js rename to test/unit/@node-red/registry/lib/resources/local/DuffNode/DuffNode.js diff --git a/test/red/runtime-registry/resources/local/DuplicateTestNode/TestNode1.html b/test/unit/@node-red/registry/lib/resources/local/DuplicateTestNode/TestNode1.html similarity index 100% rename from test/red/runtime-registry/resources/local/DuplicateTestNode/TestNode1.html rename to test/unit/@node-red/registry/lib/resources/local/DuplicateTestNode/TestNode1.html diff --git a/test/red/runtime-registry/resources/local/DuplicateTestNode/TestNode1.js b/test/unit/@node-red/registry/lib/resources/local/DuplicateTestNode/TestNode1.js similarity index 100% rename from test/red/runtime-registry/resources/local/DuplicateTestNode/TestNode1.js rename to test/unit/@node-red/registry/lib/resources/local/DuplicateTestNode/TestNode1.js diff --git a/test/red/runtime-registry/resources/local/MultipleNodes1/MultipleNodes1.html b/test/unit/@node-red/registry/lib/resources/local/MultipleNodes1/MultipleNodes1.html similarity index 100% rename from test/red/runtime-registry/resources/local/MultipleNodes1/MultipleNodes1.html rename to test/unit/@node-red/registry/lib/resources/local/MultipleNodes1/MultipleNodes1.html diff --git a/test/red/runtime-registry/resources/local/MultipleNodes1/MultipleNodes1.js b/test/unit/@node-red/registry/lib/resources/local/MultipleNodes1/MultipleNodes1.js similarity index 100% rename from test/red/runtime-registry/resources/local/MultipleNodes1/MultipleNodes1.js rename to test/unit/@node-red/registry/lib/resources/local/MultipleNodes1/MultipleNodes1.js diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/NestedNode.html b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/NestedNode.html similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/NestedNode.html rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/NestedNode.html diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/NestedNode.js b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/NestedNode.js similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/NestedNode.js rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/NestedNode.js diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.html b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.html similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.html rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.html diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.js b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.js similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.js rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/lib/ShouldNotLoad.js diff --git a/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.html b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.html new file mode 100644 index 000000000..eb7c8a3f9 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.html @@ -0,0 +1,4 @@ + + + + diff --git a/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.js b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.js new file mode 100644 index 000000000..623e299b2 --- /dev/null +++ b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/node_modules/ShouldNotLoad.js @@ -0,0 +1,5 @@ +// A test node that exports a function +module.exports = function(RED) { + function TestNode(n) {} + RED.nodes.registerType("should-not-load-2",TestNode); +} diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.html b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.html similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.html rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.html diff --git a/test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.js b/test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.js similarity index 100% rename from test/red/runtime-registry/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.js rename to test/unit/@node-red/registry/lib/resources/local/NestedDirectoryNode/NestedNode/test/ShouldNotLoad.js diff --git a/test/red/runtime-registry/resources/local/TestNode1/TestNode1.html b/test/unit/@node-red/registry/lib/resources/local/TestNode1/TestNode1.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode1/TestNode1.html rename to test/unit/@node-red/registry/lib/resources/local/TestNode1/TestNode1.html diff --git a/test/red/runtime-registry/resources/local/TestNode1/TestNode1.js b/test/unit/@node-red/registry/lib/resources/local/TestNode1/TestNode1.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode1/TestNode1.js rename to test/unit/@node-red/registry/lib/resources/local/TestNode1/TestNode1.js diff --git a/test/red/runtime-registry/resources/local/TestNode2/TestNode2.html b/test/unit/@node-red/registry/lib/resources/local/TestNode2/TestNode2.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode2/TestNode2.html rename to test/unit/@node-red/registry/lib/resources/local/TestNode2/TestNode2.html diff --git a/test/red/runtime-registry/resources/local/TestNode2/TestNode2.js b/test/unit/@node-red/registry/lib/resources/local/TestNode2/TestNode2.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode2/TestNode2.js rename to test/unit/@node-red/registry/lib/resources/local/TestNode2/TestNode2.js diff --git a/test/red/runtime-registry/resources/local/TestNode3/TestNode3.html b/test/unit/@node-red/registry/lib/resources/local/TestNode3/TestNode3.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode3/TestNode3.html rename to test/unit/@node-red/registry/lib/resources/local/TestNode3/TestNode3.html diff --git a/test/red/runtime-registry/resources/local/TestNode3/TestNode3.js b/test/unit/@node-red/registry/lib/resources/local/TestNode3/TestNode3.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode3/TestNode3.js rename to test/unit/@node-red/registry/lib/resources/local/TestNode3/TestNode3.js diff --git a/test/red/runtime-registry/resources/local/TestNode4/TestNode4.html b/test/unit/@node-red/registry/lib/resources/local/TestNode4/TestNode4.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode4/TestNode4.html rename to test/unit/@node-red/registry/lib/resources/local/TestNode4/TestNode4.html diff --git a/test/red/runtime-registry/resources/local/TestNode4/TestNode4.js b/test/unit/@node-red/registry/lib/resources/local/TestNode4/TestNode4.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNode4/TestNode4.js rename to test/unit/@node-red/registry/lib/resources/local/TestNode4/TestNode4.js diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/EmptyModule/file.txt b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/EmptyModule/file.txt similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/EmptyModule/file.txt rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/EmptyModule/file.txt diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.html b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.html rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.html diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.js b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.js rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule.js diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.html b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.html rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.html diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.js b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.js rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/TestNodeModule2.js diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/file.txt b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/file.txt similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/file.txt rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/file.txt diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/package.json b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/package.json similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/TestNodeModule/package.json rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/TestNodeModule/package.json diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.html b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.html rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.html diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.js b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.js rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule.js diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.html b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.html similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.html rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.html diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.js b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.js similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.js rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/TestNodeModule2.js diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/icons/file.txt b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/icons/file.txt similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/icons/file.txt rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/icons/file.txt diff --git a/test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/package.json b/test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/package.json similarity index 100% rename from test/red/runtime-registry/resources/local/TestNodeModule/node_modules/VersionMismatchModule/package.json rename to test/unit/@node-red/registry/lib/resources/local/TestNodeModule/node_modules/VersionMismatchModule/package.json diff --git a/test/red/runtime-registry/resources/userDir/lib/icons/file.txt b/test/unit/@node-red/registry/lib/resources/userDir/lib/icons/file.txt similarity index 100% rename from test/red/runtime-registry/resources/userDir/lib/icons/file.txt rename to test/unit/@node-red/registry/lib/resources/userDir/lib/icons/file.txt diff --git a/test/red/runtime-registry/resources/userDir/lib/icons/test_icon.png b/test/unit/@node-red/registry/lib/resources/userDir/lib/icons/test_icon.png similarity index 100% rename from test/red/runtime-registry/resources/userDir/lib/icons/test_icon.png rename to test/unit/@node-red/registry/lib/resources/userDir/lib/icons/test_icon.png diff --git a/test/red/runtime-registry/resources/userDir/nodes/TestNode5/TestNode5.html b/test/unit/@node-red/registry/lib/resources/userDir/nodes/TestNode5/TestNode5.html similarity index 100% rename from test/red/runtime-registry/resources/userDir/nodes/TestNode5/TestNode5.html rename to test/unit/@node-red/registry/lib/resources/userDir/nodes/TestNode5/TestNode5.html diff --git a/test/red/runtime-registry/resources/userDir/nodes/TestNode5/TestNode5.js b/test/unit/@node-red/registry/lib/resources/userDir/nodes/TestNode5/TestNode5.js similarity index 100% rename from test/red/runtime-registry/resources/userDir/nodes/TestNode5/TestNode5.js rename to test/unit/@node-red/registry/lib/resources/userDir/nodes/TestNode5/TestNode5.js diff --git a/test/red/runtime-api/comms_spec.js b/test/unit/@node-red/runtime/lib/api/comms_spec.js similarity index 100% rename from test/red/runtime-api/comms_spec.js rename to test/unit/@node-red/runtime/lib/api/comms_spec.js diff --git a/test/red/runtime-api/context_spec.js b/test/unit/@node-red/runtime/lib/api/context_spec.js similarity index 100% rename from test/red/runtime-api/context_spec.js rename to test/unit/@node-red/runtime/lib/api/context_spec.js diff --git a/test/red/runtime-api/flows_spec.js b/test/unit/@node-red/runtime/lib/api/flows_spec.js similarity index 100% rename from test/red/runtime-api/flows_spec.js rename to test/unit/@node-red/runtime/lib/api/flows_spec.js diff --git a/test/red/runtime-api/index_spec.js b/test/unit/@node-red/runtime/lib/api/index_spec.js similarity index 100% rename from test/red/runtime-api/index_spec.js rename to test/unit/@node-red/runtime/lib/api/index_spec.js diff --git a/test/red/runtime-api/library_spec.js b/test/unit/@node-red/runtime/lib/api/library_spec.js similarity index 100% rename from test/red/runtime-api/library_spec.js rename to test/unit/@node-red/runtime/lib/api/library_spec.js diff --git a/test/red/runtime-api/nodes_spec.js b/test/unit/@node-red/runtime/lib/api/nodes_spec.js similarity index 100% rename from test/red/runtime-api/nodes_spec.js rename to test/unit/@node-red/runtime/lib/api/nodes_spec.js diff --git a/test/red/runtime-api/projects_spec.js b/test/unit/@node-red/runtime/lib/api/projects_spec.js similarity index 100% rename from test/red/runtime-api/projects_spec.js rename to test/unit/@node-red/runtime/lib/api/projects_spec.js diff --git a/test/red/runtime-api/settings_spec.js b/test/unit/@node-red/runtime/lib/api/settings_spec.js similarity index 100% rename from test/red/runtime-api/settings_spec.js rename to test/unit/@node-red/runtime/lib/api/settings_spec.js diff --git a/test/red/runtime/events_spec.js b/test/unit/@node-red/runtime/lib/events_spec.js similarity index 100% rename from test/red/runtime/events_spec.js rename to test/unit/@node-red/runtime/lib/events_spec.js diff --git a/test/red/runtime/index_spec.js b/test/unit/@node-red/runtime/lib/index_spec.js similarity index 100% rename from test/red/runtime/index_spec.js rename to test/unit/@node-red/runtime/lib/index_spec.js diff --git a/test/red/runtime/library/index_spec.js b/test/unit/@node-red/runtime/lib/library/index_spec.js similarity index 100% rename from test/red/runtime/library/index_spec.js rename to test/unit/@node-red/runtime/lib/library/index_spec.js diff --git a/test/red/runtime/nodes/Node_spec.js b/test/unit/@node-red/runtime/lib/nodes/Node_spec.js similarity index 100% rename from test/red/runtime/nodes/Node_spec.js rename to test/unit/@node-red/runtime/lib/nodes/Node_spec.js diff --git a/test/red/runtime/nodes/context/index_spec.js b/test/unit/@node-red/runtime/lib/nodes/context/index_spec.js similarity index 100% rename from test/red/runtime/nodes/context/index_spec.js rename to test/unit/@node-red/runtime/lib/nodes/context/index_spec.js diff --git a/test/red/runtime/nodes/context/localfilesystem_spec.js b/test/unit/@node-red/runtime/lib/nodes/context/localfilesystem_spec.js similarity index 100% rename from test/red/runtime/nodes/context/localfilesystem_spec.js rename to test/unit/@node-red/runtime/lib/nodes/context/localfilesystem_spec.js diff --git a/test/red/runtime/nodes/context/memory_spec.js b/test/unit/@node-red/runtime/lib/nodes/context/memory_spec.js similarity index 100% rename from test/red/runtime/nodes/context/memory_spec.js rename to test/unit/@node-red/runtime/lib/nodes/context/memory_spec.js diff --git a/test/red/runtime/nodes/credentials_spec.js b/test/unit/@node-red/runtime/lib/nodes/credentials_spec.js similarity index 100% rename from test/red/runtime/nodes/credentials_spec.js rename to test/unit/@node-red/runtime/lib/nodes/credentials_spec.js diff --git a/test/red/runtime/nodes/flows/Flow_spec.js b/test/unit/@node-red/runtime/lib/nodes/flows/Flow_spec.js similarity index 100% rename from test/red/runtime/nodes/flows/Flow_spec.js rename to test/unit/@node-red/runtime/lib/nodes/flows/Flow_spec.js diff --git a/test/red/runtime/nodes/flows/index_spec.js b/test/unit/@node-red/runtime/lib/nodes/flows/index_spec.js similarity index 100% rename from test/red/runtime/nodes/flows/index_spec.js rename to test/unit/@node-red/runtime/lib/nodes/flows/index_spec.js diff --git a/test/red/runtime/nodes/flows/util_spec.js b/test/unit/@node-red/runtime/lib/nodes/flows/util_spec.js similarity index 100% rename from test/red/runtime/nodes/flows/util_spec.js rename to test/unit/@node-red/runtime/lib/nodes/flows/util_spec.js diff --git a/test/red/runtime/nodes/index_spec.js b/test/unit/@node-red/runtime/lib/nodes/index_spec.js similarity index 100% rename from test/red/runtime/nodes/index_spec.js rename to test/unit/@node-red/runtime/lib/nodes/index_spec.js diff --git a/test/red/runtime/nodes/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png b/test/unit/@node-red/runtime/lib/nodes/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png similarity index 100% rename from test/red/runtime/nodes/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png rename to test/unit/@node-red/runtime/lib/nodes/resources/local/NestedDirectoryNode/NestedNode/icons/arrow-in.png diff --git a/test/red/runtime/nodes/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png b/test/unit/@node-red/runtime/lib/nodes/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png similarity index 100% rename from test/red/runtime/nodes/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png rename to test/unit/@node-red/runtime/lib/nodes/resources/local/TestNodeModule/node_modules/TestNodeModule/icons/arrow-in.png diff --git a/test/red/runtime/settings_spec.js b/test/unit/@node-red/runtime/lib/settings_spec.js similarity index 100% rename from test/red/runtime/settings_spec.js rename to test/unit/@node-red/runtime/lib/settings_spec.js diff --git a/test/red/runtime/storage/index_spec.js b/test/unit/@node-red/runtime/lib/storage/index_spec.js similarity index 100% rename from test/red/runtime/storage/index_spec.js rename to test/unit/@node-red/runtime/lib/storage/index_spec.js diff --git a/test/red/runtime/storage/localfilesystem/index_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/index_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/index_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/index_spec.js diff --git a/test/red/runtime/storage/localfilesystem/library_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/library_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/library_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/library_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/Project_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/Project_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/Project_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/Project_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/defaultFileSet_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/defaultFileSet_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/defaultFileSet_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/git/authCache_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authCache_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/git/authCache_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authCache_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/git/authServer_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authServer_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/git/authServer_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authServer_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authWriter_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/authWriter_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/git/index_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/index_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/git/index_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/git/index_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/index_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/index_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/index_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/index_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/ssh/index_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/ssh/index_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/ssh/index_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/ssh/index_spec.js diff --git a/test/red/runtime/storage/localfilesystem/projects/ssh/keygen_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/ssh/keygen_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/projects/ssh/keygen_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/projects/ssh/keygen_spec.js diff --git a/test/red/runtime/storage/localfilesystem/sessions_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/sessions_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/sessions_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/sessions_spec.js diff --git a/test/red/runtime/storage/localfilesystem/settings_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/settings_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/settings_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/settings_spec.js diff --git a/test/red/runtime/storage/localfilesystem/util_spec.js b/test/unit/@node-red/runtime/lib/storage/localfilesystem/util_spec.js similarity index 100% rename from test/red/runtime/storage/localfilesystem/util_spec.js rename to test/unit/@node-red/runtime/lib/storage/localfilesystem/util_spec.js diff --git a/test/red/util/i18n_spec.js b/test/unit/@node-red/util/lib/i18n_spec.js similarity index 100% rename from test/red/util/i18n_spec.js rename to test/unit/@node-red/util/lib/i18n_spec.js diff --git a/test/red/util/index_spec.js b/test/unit/@node-red/util/lib/index_spec.js similarity index 100% rename from test/red/util/index_spec.js rename to test/unit/@node-red/util/lib/index_spec.js diff --git a/test/red/util/log_spec.js b/test/unit/@node-red/util/lib/log_spec.js similarity index 100% rename from test/red/util/log_spec.js rename to test/unit/@node-red/util/lib/log_spec.js diff --git a/test/red/runtime/util_spec.js b/test/unit/@node-red/util/lib/util_spec.js similarity index 100% rename from test/red/runtime/util_spec.js rename to test/unit/@node-red/util/lib/util_spec.js diff --git a/test/_spec.js b/test/unit/_spec.js similarity index 57% rename from test/_spec.js rename to test/unit/_spec.js index 3eb3124fa..ef09109c2 100644 --- a/test/_spec.js +++ b/test/unit/_spec.js @@ -29,9 +29,9 @@ var should = require("should"); var path = require('path'); // Directories to check with .js files and _spec.js files respectively -var rootdir = path.resolve(__dirname, ".."); -var jsdir = path.resolve(__dirname, "../red"); -var testdir = path.resolve(__dirname, "red"); +var rootdir = path.resolve(__dirname, "../.."); +var jsdir = path.resolve(__dirname, "../../packages/node_modules/"); +var testdir = path.resolve(__dirname); var walkDirectory = function(dir) { var p = fs.readdir(dir); @@ -40,28 +40,31 @@ var walkDirectory = function(dir) { var promises = []; list.forEach(function(file) { var filePath = path.join(dir,file); - promises.push(fs.stat(filePath).then(function(stat){ - if (stat.isDirectory()) { - return walkDirectory(filePath).then(function(results) { - if (results) { - errors = errors.concat(results); - } - }); - } else if (/\.js$/.test(filePath)) { - var testFile = filePath.replace(jsdir, testdir).replace(".js", "_spec.js"); - return fs.exists(testFile).then(function(exists) { - if (!exists) { - errors.push(testFile.substring(rootdir.length+1)); - } else { - return fs.stat(testFile).then(function(stat) { - if (stat.size === 0) { - errors.push("[empty] "+testFile.substring(rootdir.length+1)); - } - }) - } - }); - } - })); + + if (!/@node-red\/(editor-client|nodes)/.test(filePath)) { + promises.push(fs.stat(filePath).then(function(stat){ + if (stat.isDirectory()) { + return walkDirectory(filePath).then(function(results) { + if (results) { + errors = errors.concat(results); + } + }); + } else if (/\.js$/.test(filePath)) { + var testFile = filePath.replace(jsdir, testdir).replace(".js", "_spec.js"); + return fs.exists(testFile).then(function(exists) { + if (!exists) { + errors.push(testFile.substring(rootdir.length+1)); + } else { + return fs.stat(testFile).then(function(stat) { + if (stat.size === 0) { + errors.push("[empty] "+testFile.substring(rootdir.length+1)); + } + }) + } + }); + } + })); + } }); return Promise.all(promises).then(function() { return errors; diff --git a/test/red/red_spec.js b/test/unit/node-red/lib/red_spec.js similarity index 100% rename from test/red/red_spec.js rename to test/unit/node-red/lib/red_spec.js