diff --git a/build.xml b/build.xml index 1c18d7c..2551163 100644 --- a/build.xml +++ b/build.xml @@ -50,6 +50,7 @@ patches/7654.diff patches/7670.diff patches/7699.diff + patches/7709.diff patches/7722.diff patches/7724.diff patches/7733.diff @@ -208,7 +209,7 @@ - + diff --git a/patches/7709.diff b/patches/7709.diff new file mode 100644 index 0000000..09a5f36 --- /dev/null +++ b/patches/7709.diff @@ -0,0 +1,37 @@ +diff --git a/nbbuild/misc/prepare-bundles/src/main/java/org/netbeans/prepare/bundles/PrepareBundles.java b/nbbuild/misc/prepare-bundles/src/main/java/org/netbeans/prepare/bundles/PrepareBundles.java +index d24c6f5ec9..f2b040204e 100644 +--- a/nbbuild/misc/prepare-bundles/src/main/java/org/netbeans/prepare/bundles/PrepareBundles.java ++++ b/nbbuild/misc/prepare-bundles/src/main/java/org/netbeans/prepare/bundles/PrepareBundles.java +@@ -58,7 +58,8 @@ public class PrepareBundles { + Pattern.compile("license", Pattern.CASE_INSENSITIVE), + Pattern.compile("LICENSE.txt", Pattern.CASE_INSENSITIVE), + Pattern.compile("LICENSE-MIT.txt", Pattern.CASE_INSENSITIVE), +- Pattern.compile("LICENSE.md", Pattern.CASE_INSENSITIVE) ++ Pattern.compile("LICENSE.md", Pattern.CASE_INSENSITIVE), ++ Pattern.compile("LICENSE.markdown", Pattern.CASE_INSENSITIVE) + ); + private static final String nl = "\n"; + +@@ -69,7 +70,12 @@ public class PrepareBundles { + + Path targetDir = Paths.get(args[0]); + Path packagesDir = targetDir.resolve("package"); +- new ProcessBuilder("npm", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor(); ++ String os = System.getProperty("os.name").toLowerCase(); ++ if (os.contains("windows")) { ++ new ProcessBuilder("npm.cmd", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor(); ++ } else{ ++ new ProcessBuilder("npm", "install").directory(packagesDir.toFile()).inheritIO().start().waitFor(); ++ } + Path bundlesDir = targetDir.resolve("bundles"); + Files.createDirectories(bundlesDir); + try (DirectoryStream ds = Files.newDirectoryStream(bundlesDir)) { +@@ -107,6 +113,8 @@ public class PrepareBundles { + if ("@types".equals(module.getFileName().toString())) continue; + if ("@esbuild".equals(module.getFileName().toString())) continue; + if ("@microsoft".equals(module.getFileName().toString())) continue; ++ if ("eastasianwidth".equals(module.getFileName().toString())) continue; ++ if ("isarray".equals(module.getFileName().toString())) continue; + Path packageJson = module.resolve("package.json"); + if (Files.isReadable(packageJson)) { + checkModule(module, sb, tokens2Projects, project2License, bundlesDir, targetDir, externalDir, binariesList); diff --git a/vscode/package-lock.json b/vscode/package-lock.json index eff871f..8ead438 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -23,12 +23,12 @@ "@types/vscode": "^1.76.0", "@types/vscode-webview": "^1.57.1", "@vscode/codicons": "0.0.29", + "@vscode/test-electron": "^2.4.1", "esbuild": "^0.16.17", "glob": "^7.1.6", "mocha": "^9.1.2", "ps-node": "^0.1.6", - "typescript": "^4.6.4", - "vscode-test": "^1.3.0" + "typescript": "^4.6.4" }, "engines": { "vscode": "^1.76.0" @@ -496,6 +496,22 @@ "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==", "license": "MIT" }, + "node_modules/@vscode/test-electron": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", + "integrity": "sha512-Gc6EdaLANdktQ1t+zozoBVRynfIsMKMc94Svu1QreOBC8y76x4tvaK32TljrLi1LI2+PK58sDVbL7ALdqf3VRQ==", + "dev": true, + "dependencies": { + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", + "jszip": "^3.10.1", + "ora": "^7.0.1", + "semver": "^7.6.2" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@vscode/webview-ui-toolkit": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@vscode/webview-ui-toolkit/-/webview-ui-toolkit-1.2.2.tgz", @@ -510,16 +526,40 @@ } }, "node_modules/agent-base": { - "version": "4.3.0", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, - "license": "MIT", "dependencies": { - "es6-promisify": "^5.0.0" + "ms": "^2.1.3" }, "engines": { - "node": ">= 4.0.0" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "node_modules/ansi-colors": { "version": "4.1.1", "dev": true, @@ -571,6 +611,26 @@ "version": "1.0.0", "license": "MIT" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/binary-extensions": { "version": "2.2.0", "dev": true, @@ -579,6 +639,31 @@ "node": ">=8" } }, + "node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dev": true, + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "dev": true, @@ -605,6 +690,30 @@ "dev": true, "license": "ISC" }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/camelcase": { "version": "6.2.0", "dev": true, @@ -668,6 +777,33 @@ "fsevents": "~2.3.2" } }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "7.0.4", "dev": true, @@ -704,6 +840,12 @@ "dev": true, "license": "MIT" }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "node_modules/debug": { "version": "4.3.3", "dev": true, @@ -739,24 +881,17 @@ "node": ">=0.3.1" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/emoji-regex": { "version": "8.0.0", "dev": true, "license": "MIT" }, - "node_modules/es6-promise": { - "version": "4.2.8", - "dev": true, - "license": "MIT" - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-promise": "^4.0.3" - } - }, "node_modules/esbuild": { "version": "0.16.17", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.17.tgz", @@ -933,50 +1068,79 @@ } }, "node_modules/http-proxy-agent": { - "version": "2.1.0", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, - "license": "MIT", "dependencies": { - "agent-base": "4", - "debug": "3.1.0" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": ">= 4.5.0" + "node": ">= 14" } }, "node_modules/http-proxy-agent/node_modules/debug": { - "version": "3.1.0", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, - "license": "MIT", "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/http-proxy-agent/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true }, "node_modules/https-proxy-agent": { - "version": "2.2.4", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dev": true, - "license": "MIT", "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" + "agent-base": "^7.0.2", + "debug": "4" }, "engines": { - "node": ">= 4.5.0" + "node": ">= 14" } }, - "node_modules/https-proxy-agent/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true, - "dependencies": { - "ms": "^2.1.1" - } + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true }, "node_modules/inflight": { "version": "1.0.6", @@ -1030,6 +1194,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -1058,6 +1234,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "dev": true, @@ -1085,6 +1267,27 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/locate-path": { "version": "6.0.0", "dev": true, @@ -1126,14 +1329,13 @@ "loose-envify": "cli.js" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { - "node": ">=10" + "node": ">=6" } }, "node_modules/minimatch": { @@ -1241,6 +1443,134 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz", + "integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==", + "dev": true, + "dependencies": { + "chalk": "^5.3.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.9.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.3.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "string-width": "^6.1.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "node_modules/ora/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dev": true, + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/string-width": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", + "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^10.2.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/p-limit": { "version": "3.1.0", "dev": true, @@ -1269,6 +1599,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "node_modules/path-exists": { "version": "4.0.0", "dev": true, @@ -1296,6 +1632,12 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "node_modules/ps-node": { "version": "0.1.6", "dev": true, @@ -1324,6 +1666,27 @@ "node": ">=0.10.0" } }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/readdirp": { "version": "3.6.0", "dev": true, @@ -1343,15 +1706,20 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "2.6.3", + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", "dev": true, - "license": "ISC", "dependencies": { - "glob": "^7.1.3" + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" }, - "bin": { - "rimraf": "bin.js" + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/safe-buffer": { @@ -1374,12 +1742,9 @@ "license": "MIT" }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -1395,6 +1760,48 @@ "randombytes": "^2.1.0" } }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dev": true, + "dependencies": { + "bl": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/string-width": { "version": "4.2.3", "dev": true, @@ -1487,6 +1894,12 @@ "node": ">=4.2.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, "node_modules/vscode-jsonrpc": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", @@ -1541,19 +1954,6 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" }, - "node_modules/vscode-test": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.4", - "rimraf": "^2.6.3" - }, - "engines": { - "node": ">=8.9.3" - } - }, "node_modules/which": { "version": "2.0.2", "dev": true, @@ -1602,10 +2002,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "license": "ISC" - }, "node_modules/yargs": { "version": "16.2.0", "dev": true, @@ -1909,6 +2305,19 @@ "resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.18.tgz", "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==" }, + "@vscode/test-electron": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", + "integrity": "sha512-Gc6EdaLANdktQ1t+zozoBVRynfIsMKMc94Svu1QreOBC8y76x4tvaK32TljrLi1LI2+PK58sDVbL7ALdqf3VRQ==", + "dev": true, + "requires": { + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", + "jszip": "^3.10.1", + "ora": "^7.0.1", + "semver": "^7.6.2" + } + }, "@vscode/webview-ui-toolkit": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@vscode/webview-ui-toolkit/-/webview-ui-toolkit-1.2.2.tgz", @@ -1920,10 +2329,29 @@ } }, "agent-base": { - "version": "4.3.0", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dev": true, "requires": { - "es6-promisify": "^5.0.0" + "debug": "^4.3.4" + }, + "dependencies": { + "debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } } }, "ansi-colors": { @@ -1956,10 +2384,40 @@ "balanced-match": { "version": "1.0.0" }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, "binary-extensions": { "version": "2.2.0", "dev": true }, + "bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dev": true, + "requires": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "brace-expansion": { "version": "1.1.11", "dev": true, @@ -1981,6 +2439,16 @@ "version": "1.3.1", "dev": true }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "camelcase": { "version": "6.2.0", "dev": true @@ -2016,6 +2484,21 @@ "readdirp": "~3.6.0" } }, + "cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "requires": { + "restore-cursor": "^4.0.0" + } + }, + "cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true + }, "cliui": { "version": "7.0.4", "dev": true, @@ -2044,6 +2527,12 @@ "version": "1.0.0", "dev": true }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "debug": { "version": "4.3.3", "dev": true, @@ -2059,21 +2548,16 @@ "version": "5.0.0", "dev": true }, - "emoji-regex": { - "version": "8.0.0", + "eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, - "es6-promise": { - "version": "4.2.8", + "emoji-regex": { + "version": "8.0.0", "dev": true }, - "es6-promisify": { - "version": "5.0.0", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - } - }, "esbuild": { "version": "0.16.17", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.17.tgz", @@ -2183,45 +2667,54 @@ "dev": true }, "http-proxy-agent": { - "version": "2.1.0", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "requires": { - "agent-base": "4", - "debug": "3.1.0" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "dependencies": { "debug": { - "version": "3.1.0", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.3" } }, "ms": { - "version": "2.0.0", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true } } }, "https-proxy-agent": { - "version": "2.2.4", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dev": true, "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } + "agent-base": "^7.0.2", + "debug": "4" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true + }, "inflight": { "version": "1.0.6", "dev": true, @@ -2256,6 +2749,12 @@ "is-extglob": "^2.1.1" } }, + "is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2270,6 +2769,12 @@ "version": "0.1.0", "dev": true }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "isexe": { "version": "2.0.0", "dev": true @@ -2292,6 +2797,27 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" }, + "jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "requires": { + "immediate": "~3.0.5" + } + }, "locate-path": { "version": "6.0.0", "dev": true, @@ -2316,11 +2842,11 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, - "lru-cache": { - "version": "6.0.0", - "requires": { - "yallist": "^4.0.0" - } + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "minimatch": { "version": "3.1.2", @@ -2399,6 +2925,88 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "ora": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz", + "integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==", + "dev": true, + "requires": { + "chalk": "^5.3.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.9.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.3.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "string-width": "^6.1.0", + "strip-ansi": "^7.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true + }, + "emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "dev": true + }, + "log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dev": true, + "requires": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + } + }, + "string-width": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", + "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^10.2.1", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "p-limit": { "version": "3.1.0", "dev": true, @@ -2413,6 +3021,12 @@ "p-limit": "^3.0.2" } }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "path-exists": { "version": "4.0.0", "dev": true @@ -2425,6 +3039,12 @@ "version": "2.3.1", "dev": true }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "ps-node": { "version": "0.1.6", "dev": true, @@ -2448,6 +3068,29 @@ "loose-envify": "^1.1.0" } }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, "readdirp": { "version": "3.6.0", "dev": true, @@ -2459,11 +3102,14 @@ "version": "2.1.1", "dev": true }, - "rimraf": { - "version": "2.6.3", + "restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", "dev": true, "requires": { - "glob": "^7.1.3" + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" } }, "safe-buffer": { @@ -2471,12 +3117,9 @@ "dev": true }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==" }, "serialize-javascript": { "version": "6.0.0", @@ -2485,6 +3128,44 @@ "randombytes": "^2.1.0" } }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dev": true, + "requires": { + "bl": "^5.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, "string-width": { "version": "4.2.3", "dev": true, @@ -2544,6 +3225,12 @@ "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", "dev": true }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, "vscode-jsonrpc": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.1.0.tgz", @@ -2591,15 +3278,6 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.3.tgz", "integrity": "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA==" }, - "vscode-test": { - "version": "1.4.0", - "dev": true, - "requires": { - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.4", - "rimraf": "^2.6.3" - } - }, "which": { "version": "2.0.2", "dev": true, @@ -2628,9 +3306,6 @@ "version": "5.0.8", "dev": true }, - "yallist": { - "version": "4.0.0" - }, "yargs": { "version": "16.2.0", "dev": true, diff --git a/vscode/package.json b/vscode/package.json index 69114d2..4908703 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -770,9 +770,9 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./; node ./esbuild.js", + "compile": "tsc -p ./ && node ./esbuild.js", "watch": "tsc -watch -p ./ | node ./esbuild.js --watch", - "test": "node ./out/test/runTest.js", + "test": "npm run compile && node ./out/test/runTest.js", "nbcode": "node ./out/nbcode.js", "nbjavac": "node ./out/nbcode.js -J-Dnetbeans.close=true --modules --install .*nbjavac.*", "apisupport": "node ./out/nbcode.js -J-Dnetbeans.close=true --modules --install '(org.netbeans.libs.xerces|org.netbeans.modules.editor.structure|org.netbeans.modules.xml|org.netbeans.modules.xml.axi|org.netbeans.modules.xml.retriever|org.netbeans.modules.xml.schema.model|org.netbeans.modules.xml.tax|org.netbeans.modules.xml.text|org.netbeans.modules.ant.browsetask|.*apisupport.*|org.netbeans.modules.debugger.jpda.ant)' && node ./out/nbcode.js -J-Dnetbeans.close=true --modules --enable .*apisupport.ant", @@ -786,12 +786,12 @@ "@types/vscode": "^1.76.0", "@types/vscode-webview": "^1.57.1", "@vscode/codicons": "0.0.29", + "@vscode/test-electron": "^2.4.1", "esbuild": "^0.16.17", "glob": "^7.1.6", "mocha": "^9.1.2", "ps-node": "^0.1.6", - "typescript": "^4.6.4", - "vscode-test": "^1.3.0" + "typescript": "^4.6.4" }, "dependencies": { "@vscode/debugadapter": "^1.65.0", diff --git a/vscode/src/test/suite/constants.ts b/vscode/src/test/constants.ts similarity index 67% rename from vscode/src/test/suite/constants.ts rename to vscode/src/test/constants.ts index 22cd794..3438d5f 100644 --- a/vscode/src/test/suite/constants.ts +++ b/vscode/src/test/constants.ts @@ -161,4 +161,81 @@ public class RefactorActions { System.out.println("Test 1 func called"); } } -`; \ No newline at end of file +`; + +export const FORMATTED_POM_XML: string = ` + 4.0.0 + org.netbeans.demo.vscode.t1 + basicapp + 1.0 + + 1.8 + 1.8 + pkg.Main + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + + + + + org.junit.jupiter + junit-jupiter-api + 5.3.1 + test + + + org.junit.jupiter + junit-jupiter-params + 5.3.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.3.1 + test + + + +`; + + +export const SAMPLE_BUILD_GRADLE = + ` +plugins { + id 'java' + id 'application' +} + +repositories { + mavenCentral() +} + +application { + mainClassName = 'org.yourCompany.yourProject.App' +} +`; + +export const SAMPLE_SETTINGS_GRADLE = + ` +rootProject.name = 'yourProject' + +include ':yourProject' +`; + +export const SAMPLE_APP_JAVA = + ` +package org.yourCompany.yourProject; + +public class App { + public static void main(String[] args) { + System.out.println("Hello, yourProject!"); + } +} +` \ No newline at end of file diff --git a/vscode/src/test/runTest.ts b/vscode/src/test/runTest.ts index cb972cd..994d8d8 100644 --- a/vscode/src/test/runTest.ts +++ b/vscode/src/test/runTest.ts @@ -19,7 +19,7 @@ */ import * as path from 'path'; -import { downloadAndUnzipVSCode, runTests } from 'vscode-test'; +import { downloadAndUnzipVSCode, runTests } from '@vscode/test-electron'; import * as fs from 'fs'; @@ -28,42 +28,49 @@ async function main() { // The folder containing the Extension Manifest package.json // Passed to `--extensionDevelopmentPath` const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + const outRootPath = path.join(extensionDevelopmentPath, 'out'); const vscodeExecutablePath: string = await downloadAndUnzipVSCode('stable'); - // The path to test runner - // Passed to --extensionTestsPath - const extensionTestsPath = path.resolve(__dirname, './suite/index'); + const vscodeTestDir = path.join(__dirname, "vscode"); + const extDir = path.join(vscodeTestDir, "exts"); + const userDir = path.join(vscodeTestDir, "user"); + const suitesDir = path.join(__dirname, 'suite'); + const testSuites = fs.readdirSync(suitesDir); - const workspaceDir = path.join(extensionDevelopmentPath, 'out', 'test', 'ws'); + for (const suiteName of testSuites) { + // The path to test runner + // Passed to --extensionTestsPath + const suiteDir = path.join(suitesDir, suiteName); + const extensionTestsPath = path.join(suiteDir, 'index'); + const workspaceDir = path.join(suiteDir, 'ws'); - const outRoot = path.join(extensionDevelopmentPath, "out"); - const extDir = path.join(outRoot, "test", "vscode", "exts"); - const userDir = path.join(outRoot, "test", "vscode", "user"); + if (fs.existsSync(workspaceDir)) { + fs.rmdirSync(workspaceDir, { recursive: true }); + } + fs.mkdirSync(workspaceDir, { recursive: true }); - if (!fs.statSync(workspaceDir).isDirectory()) { - throw `Expecting ${workspaceDir} to be a directory!`; + // Download VS Code, unzip it and run the integration test + await runTests({ + vscodeExecutablePath, + extensionDevelopmentPath, + extensionTestsPath, + extensionTestsEnv: { + 'ENABLE_CONSOLE_LOG': 'true', + "netbeans.extra.options": `-J-Dproject.limitScanRoot=${outRootPath} -J-Dnetbeans.logger.console=true` + }, + launchArgs: [ + '--disable-extensions', + '--disable-workspace-trust', + '--extensions-dir', `${extDir}`, + '--user-data-dir', `${userDir}`, + workspaceDir + ] + }); } - - // Download VS Code, unzip it and run the integration test - await runTests({ - vscodeExecutablePath, - extensionDevelopmentPath, - extensionTestsPath, - extensionTestsEnv: { - 'ENABLE_CONSOLE_LOG' : 'true', - "netbeans.extra.options" : `-J-Dproject.limitScanRoot=${outRoot} -J-Dnetbeans.logger.console=true` - }, - launchArgs: [ - '--disable-extensions', - '--disable-workspace-trust', - '--extensions-dir', `${extDir}`, - '--user-data-dir', `${userDir}`, - workspaceDir - ] - }); } catch (err) { console.error('Failed to run tests'); + console.error((err as Error).message); process.exit(1); } } diff --git a/vscode/src/test/suite/extension.test.ts b/vscode/src/test/suite/extension.test.ts deleted file mode 100644 index 6ff8bc1..0000000 --- a/vscode/src/test/suite/extension.test.ts +++ /dev/null @@ -1,302 +0,0 @@ - -/* - * Copyright (c) 2023, Oracle and/or its affiliates. - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* This file has been modified for Oracle Java SE extension */ - -import * as assert from 'assert'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as vscode from 'vscode'; -import * as myExtension from '../../extension'; -import * as myExplorer from '../../explorer'; - -import { CodeAction, commands, extensions, Selection, Uri, window, workspace, TreeItem } from 'vscode'; -import { assertWorkspace, dumpJava, getFilePaths, openFile, prepareProject, replaceCode} from './testutils'; -import {SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS } from './constants'; - -suite('Extension Test Suite', function () { - window.showInformationMessage('Start all tests.'); - - const filePaths = getFilePaths(); - - // Create project which used be used for testing - this.beforeAll(async () => { - await prepareProject(filePaths); - }).timeout(10000); - - // This test must be run first, in order to activate the extension and wait for the activation to complete - test("Extension loaded and activated", async () => { - const extension = extensions.getExtension('oracle.oracle-java'); - assert(extension, "No Java extension found!"); - - const api = await extension.activate(); - assert(extension?.isActive, "true"); - assert.ok(api.version, "Some version is specified"); - - let cannotReassignVersion = false; - try { - api.version = "different"; - } catch (e) { - cannotReassignVersion = true; - } - assert.ok(cannotReassignVersion, "Cannot reassign value of version"); - - }).timeout(10000); - - // Test if clusters are loaded or not - test('Find clusters', async () => { - const nbcode = extensions.getExtension('oracle.oracle-java'); - assert(nbcode); - - const extraCluster = path.join(nbcode.extensionPath, "nbcode", "extra"); - let clusters = myExtension.findClusters('non-existent'). - // ignore 'extra' cluster in the extension path, since nbjavac is there during development: - filter(s => !s.startsWith(extraCluster)); - - let found: string[] = []; - function assertCluster(name: string) { - for (let c of clusters) { - if (c.endsWith('/' + name)) { - found.push(c); - return; - } - } - assert.fail(`Cannot find ${name} among ${clusters}`); - } - - assertCluster('extide'); - assertCluster('ide'); - assertCluster('java'); - assertCluster('nbcode'); - assertCluster('platform'); - assertCluster('webcommon'); - assertCluster('harness'); - - for (let c of found) { - assert.ok(c.startsWith(nbcode.extensionPath), `All extensions are below ${nbcode.extensionPath}, but: ${c}`); - } - }).timeout(10000); - - // Check if Jdk commands have been loaded - test("Jdk commands loaded", async () => { - let commandsList = await commands.getCommands(true); - - let containsJdkCommands: Boolean = false; - for (const command of commandsList) { - if (command.indexOf("jdk.") === 0) { - containsJdkCommands = true; - } - } - - assert.ok(containsJdkCommands, "No Jdk command has been loaded"); - }).timeout(10000); - - // Check if format document command is executed successfully - test("Format document", async () => { - const editor = await openFile(filePaths.formatDocument); - await commands.executeCommand('editor.action.formatDocument'); - - const formattedCode = editor.document.getText().split('\n').length; - const unformattedCode = SAMPLE_CODE_FORMAT_DOCUMENT.split('\n').length; - const isDocumentFormatted = formattedCode > unformattedCode; - assert.ok(isDocumentFormatted, "document is not formatted"); - }).timeout(10000); - - // Check if imports are getting sorted on saving document - test("Sort imports", async () => { - const editor = await openFile(filePaths.sortImports); - await replaceCode(editor, SAMPLE_CODE_SORT_IMPORTS); - - const isSaved = await editor.document.save(); - assert.ok(isSaved, "document cannot be saved"); - - const savedCode = editor.document.getText(); - const isImportsSorted = savedCode.indexOf('import java.util.Date;') > - savedCode.indexOf('import java.util.ArrayList;'); - assert.ok(isImportsSorted, "Imports are not sorted"); - - }).timeout(10000); - - // Check if unused imports are getting removed on saving document - test("Remove unused imports", async () => { - const editor = await openFile(filePaths.unusedImports); - await replaceCode(editor, SAMPLE_CODE_UNUSED_IMPORTS); - - const isSaved = await editor.document.save(); - assert.ok(isSaved, "document cannot be saved"); - - const savedCode = editor.document.getText(); - const areUnusedImportsRemoved = savedCode.indexOf('import java.lang.Float;') === -1 && - savedCode.indexOf('import java.lang.Integer;') === -1; - assert.ok(areUnusedImportsRemoved, "Unused imports are not removed"); - - }).timeout(10000); - - // Check if refactor actions are getting showing on UI and if they are working - test("Refactor actions executing", async () => { - const editor = await openFile(filePaths.refactorActions); - const doc = editor.document; - const sel = new Selection(doc.lineAt(12).range.start, doc.lineAt(12).range.end); - editor.selections = [sel]; - - const refactorActions = await commands.executeCommand( - 'vscode.executeCodeActionProvider', - doc.uri, - sel - ); - - if (refactorActions && refactorActions.length > 0) { - for await (const action of refactorActions) { - if (action.command && action.command.arguments) { - if (action.command.command === myExtension.COMMAND_PREFIX + ".surround.with") { - //this action has a popup where the user needs to - //select a template that should be used for the surround: - continue; - } - await commands.executeCommand(action.command.command, ...action.command.arguments); - await commands.executeCommand('undo'); - } - } - } - }).timeout(10000); - - // Tests explorer is loading properly - test("Test Explorer tests", async () => { - let folder: string = assertWorkspace(); - - try { - console.log("Test: load workspace tests"); - const workspaceFolder = (workspace.workspaceFolders!)[0]; - let tests: any = await commands.executeCommand("jdk.load.workspace.tests", workspaceFolder.uri.toString()); - console.log(`Test: load workspace tests finished with ${tests}`); - assert.ok(tests, "No tests returned for workspace"); - assert.strictEqual(tests.length, 2, `Invalid number of test suites returned`); - assert.strictEqual(tests[0].name, 'pkg.MainTest', `Invalid test suite name returned`); - assert.strictEqual(tests[0].tests.length, 1, `Invalid number of tests in suite returned`); - assert.strictEqual(tests[0].tests[0].name, 'testGetName', `Invalid test name returned`); - assert.strictEqual(tests[1].name, 'pkg.MainTest$NestedTest', `Invalid test suite name returned`); - assert.strictEqual(tests[1].tests.length, 1, `Invalid number of tests in suite returned`); - assert.strictEqual(tests[1].tests[0].name, 'testTrue', `Invalid test name returned`); - - console.log("Test: run all workspace tests"); - await vscode.commands.executeCommand(myExtension.COMMAND_PREFIX + '.run.test', workspaceFolder.uri.toString()); - console.log(`Test: run all workspace tests finished`); - } catch (error) { - dumpJava(); - throw error; - } - }).timeout(10000); - - // Check if compile workspace command is excuted succesfully - test("Compile workspace", async () => { - let folder: string = assertWorkspace(); - const compile = await commands.executeCommand('jdk.workspace.compile'); - assert.ok(compile, " Compile workspace command not working"); - - - const mainClass = path.join(folder, 'target', 'classes', 'pkg', 'Main.class'); - assert.ok(fs.statSync(mainClass).isFile(), "Class created by compilation: " + mainClass); - - myExplorer.createViewProvider(await myExtension.awaitClient(), "foundProjects").then(async (lvp) => { - const firstLevelChildren = await (lvp.getChildren() as Thenable); - assert.strictEqual(firstLevelChildren.length, 1, "One child under the root"); - const item = await (lvp.getTreeItem(firstLevelChildren[0]) as Thenable); - assert.strictEqual(item?.label, "basicapp", "Element is named as the Maven project"); - }); - }).timeout(10000); - - // Get Project info - test("Get project sources, classpath, and packages", async () => { - let folder: string = assertWorkspace(); - try { - console.log("Test: get project java source roots"); - let res: any = await commands.executeCommand("jdk.java.get.project.source.roots", Uri.file(folder).toString()); - console.log(`Test: get project java source roots finished with ${res}`); - assert.ok(res, "No java source root returned"); - assert.strictEqual(res.length, 2, `Invalid number of java roots returned`); - assert.strictEqual(res[0], path.join('file:', folder, 'src', 'main', 'java') + path.sep, `Invalid java main source root returned`); - assert.strictEqual(res[1], path.join('file:', folder, 'src', 'test', 'java') + path.sep, `Invalid java test source root returned`); - - console.log("Test: get project resource roots"); - res = await commands.executeCommand("jdk.java.get.project.source.roots", Uri.file(folder).toString(), 'resources'); - console.log(`Test: get project resource roots finished with ${res}`); - assert.ok(res, "No resource root returned"); - assert.strictEqual(res.length, 1, `Invalid number of resource roots returned`); - assert.strictEqual(res[0], path.join('file:', folder, 'src', 'main', 'resources') + path.sep, `Invalid resource root returned`); - - console.log("Test: get project compile classpath"); - res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString()); - console.log(`Test: get project compile classpath finished with ${res}`); - assert.ok(res, "No compile classpath returned"); - assert.strictEqual(res.length, 9, `Invalid number of compile classpath roots returned`); - assert.ok(res.find((item: any) => item === path.join('file:', folder, 'target', 'classes') + path.sep, `Invalid compile classpath root returned`)); - - console.log("Test: get project source classpath"); - res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'SOURCE'); - console.log(`Test: get project source classpath finished with ${res}`); - assert.ok(res, "No source classpath returned"); - assert.strictEqual(res.length, 3, `Invalid number of source classpath roots returned`); - assert.ok(res.find((item: any) => item === path.join('file:', folder, 'src', 'main', 'java') + path.sep, `Invalid source classpath root returned`)); - assert.ok(res.find((item: any) => item === path.join('file:', folder, 'src', 'main', 'resources') + path.sep, `Invalid source classpath root returned`)); - assert.ok(res.find((item: any) => item === path.join('file:', folder, 'src', 'test', 'java') + path.sep, `Invalid source classpath root returned`)); - - console.log("Test: get project boot classpath"); - res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'BOOT'); - console.log(`Test: get project boot classpath finished with ${res}`); - assert.ok(res, "No boot classpath returned"); - assert.ok(res.length > 0, `Invalid number of boot classpath roots returned`); - - console.log("Test: get project boot source classpath"); - res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'BOOT', true); - console.log(`Test: get project boot source classpath finished with ${res}`); - assert.ok(res, "No boot source classpath returned"); - assert.ok(res.length > 0, `Invalid number of boot source classpath roots returned`); - - console.log("Test: get all project packages"); - res = await commands.executeCommand("jdk.java.get.project.packages", Uri.file(folder).toString()); - console.log(`Test: get all project packages finished with ${res}`); - assert.ok(res, "No packages returned"); - assert.ok(res.length > 0, `Invalid number of packages returned`); - - console.log("Test: get project source packages"); - res = await commands.executeCommand("jdk.java.get.project.packages", Uri.file(folder).toString(), true); - console.log(`Test: get project source packages finished with ${res}`); - assert.ok(res, "No packages returned"); - assert.strictEqual(res.length, 1, `Invalid number of packages returned`); - assert.strictEqual(res[0], 'pkg', `Invalid package returned`); - } catch (error) { - dumpJava(); - throw error; - } - }).timeout(10000); - - // Check if clean workspace command is excuted succesfully - test("Clean workspace", async () => { - let folder: string = assertWorkspace(); - const clean = await commands.executeCommand('jdk.workspace.clean'); - assert.ok(clean, " Clean workspace command not working"); - - const mainClass = path.join(folder, 'target'); - assert.ok(!fs.existsSync(mainClass), "Class created by compilation: " + mainClass); - }).timeout(10000); - -}); \ No newline at end of file diff --git a/vscode/src/test/suite/explorer.test.ts b/vscode/src/test/suite/general/explorer.test.ts similarity index 76% rename from vscode/src/test/suite/explorer.test.ts rename to vscode/src/test/suite/general/explorer.test.ts index e51b04f..57c7f8e 100644 --- a/vscode/src/test/suite/explorer.test.ts +++ b/vscode/src/test/suite/general/explorer.test.ts @@ -21,22 +21,12 @@ */ import * as assert from 'assert'; -import * as fs from 'fs'; -import * as Mocha from 'mocha'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import * as myExtension from '../../extension'; -import * as myExplorer from '../../explorer'; -import { assertWorkspace } from './testutils'; - -Mocha.before(async () => { - vscode.window.showInformationMessage('Cleaning up workspace.'); - let folder: string = assertWorkspace(); - await fs.promises.rmdir(folder, { recursive: true }); - await fs.promises.mkdir(folder, { recursive: true }); -}); +import * as myExtension from '../../../extension'; +import * as myExplorer from '../../../explorer'; suite('Explorer Test Suite', () => { vscode.window.showInformationMessage('Start explorer tests.'); diff --git a/vscode/src/test/suite/general/extension.test.ts b/vscode/src/test/suite/general/extension.test.ts new file mode 100644 index 0000000..49d3a44 --- /dev/null +++ b/vscode/src/test/suite/general/extension.test.ts @@ -0,0 +1,310 @@ + +/* + * Copyright (c) 2023, Oracle and/or its affiliates. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* This file has been modified for Oracle Java SE extension */ + +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; +import * as vscode from 'vscode'; +import * as myExtension from '../../../extension'; +import * as myExplorer from '../../../explorer'; +import { CodeAction, commands, extensions, Selection, Uri, window, workspace, TreeItem } from 'vscode'; +import { assertWorkspace, dumpJava, getFilePaths, openFile, prepareProject, replaceCode } from '../../testutils'; +import { FORMATTED_POM_XML, SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS } from '../../constants'; + +suite('Extension Test Suite', function () { + window.showInformationMessage('Start all tests.'); + + const filePaths = getFilePaths(); + + // Create project which used be used for testing + this.beforeAll(async () => { + await prepareProject(filePaths); + }).timeout(10000); + + // This test must be run first, in order to activate the extension and wait for the activation to complete + test("Extension loaded and activated", async () => { + const extension = extensions.getExtension('oracle.oracle-java'); + assert(extension, "No Java extension found!"); + + const api = await extension.activate(); + assert(extension?.isActive, "true"); + assert.ok(api.version, "Some version is specified"); + + let cannotReassignVersion = false; + try { + api.version = "different"; + } catch (e) { + cannotReassignVersion = true; + } + assert.ok(cannotReassignVersion, "Cannot reassign value of version"); + + }).timeout(10000); + + // Test if clusters are loaded or not + test('Find clusters', async () => { + const nbcode = extensions.getExtension('oracle.oracle-java'); + assert(nbcode); + + const extraCluster = path.join(nbcode.extensionPath, "nbcode", "extra"); + let clusters = myExtension.findClusters('non-existent'). + // ignore 'extra' cluster in the extension path, since nbjavac is there during development: + filter(s => !s.startsWith(extraCluster)); + + let found: string[] = []; + function assertCluster(name: string) { + for (let c of clusters) { + if (c.endsWith('/' + name) || c.endsWith('\\' + name)) { + found.push(c); + return; + } + } + assert.fail(`Cannot find ${name} among ${clusters}`); + } + + assertCluster('extide'); + assertCluster('ide'); + assertCluster('java'); + assertCluster('nbcode'); + assertCluster('platform'); + assertCluster('webcommon'); + assertCluster('harness'); + + for (let c of found) { + assert.ok(c.startsWith(nbcode.extensionPath), `All extensions are below ${nbcode.extensionPath}, but: ${c}`); + } + }).timeout(10000); + + // Check if Jdk commands have been loaded + test("Jdk commands loaded", async () => { + let commandsList = await commands.getCommands(true); + + let containsJdkCommands: Boolean = false; + for (const command of commandsList) { + if (command.indexOf("jdk.") === 0) { + containsJdkCommands = true; + } + } + + assert.ok(containsJdkCommands, "No Jdk command has been loaded"); + }).timeout(10000); + + // Check if format document command is executed successfully + test("Format document", async () => { + const editor = await openFile(filePaths.formatDocument); + await commands.executeCommand('editor.action.formatDocument'); + + const formattedCode = editor.document.getText().split('\n').length; + const unformattedCode = SAMPLE_CODE_FORMAT_DOCUMENT.split('\n').length; + const isDocumentFormatted = formattedCode > unformattedCode; + assert.ok(isDocumentFormatted, "document is not formatted"); + }).timeout(10000); + + // Check if imports are getting sorted on saving document + test("Sort imports", async () => { + const editor = await openFile(filePaths.sortImports); + await replaceCode(editor, SAMPLE_CODE_SORT_IMPORTS); + + const isSaved = await editor.document.save(); + assert.ok(isSaved, "document cannot be saved"); + + const savedCode = editor.document.getText(); + const isImportsSorted = savedCode.indexOf('import java.util.Date;') > + savedCode.indexOf('import java.util.ArrayList;'); + assert.ok(isImportsSorted, "Imports are not sorted"); + + }).timeout(10000); + + // Check if unused imports are getting removed on saving document + test("Remove unused imports", async () => { + const editor = await openFile(filePaths.unusedImports); + await replaceCode(editor, SAMPLE_CODE_UNUSED_IMPORTS); + + const isSaved = await editor.document.save(); + assert.ok(isSaved, "document cannot be saved"); + + const savedCode = editor.document.getText(); + const areUnusedImportsRemoved = savedCode.indexOf('import java.lang.Float;') === -1 && + savedCode.indexOf('import java.lang.Integer;') === -1; + assert.ok(areUnusedImportsRemoved, "Unused imports are not removed"); + + }).timeout(10000); + + // Check if refactor actions are getting showing on UI and if they are working + test("Refactor actions executing", async () => { + const editor = await openFile(filePaths.refactorActions); + const doc = editor.document; + const sel = new Selection(doc.lineAt(12).range.start, doc.lineAt(12).range.end); + editor.selections = [sel]; + + const refactorActions = await commands.executeCommand( + 'vscode.executeCodeActionProvider', + doc.uri, + sel + ); + + if (refactorActions && refactorActions.length > 0) { + for await (const action of refactorActions) { + if (action.command && action.command.arguments) { + if (action.command.command === myExtension.COMMAND_PREFIX + ".surround.with") { + //this action has a popup where the user needs to + //select a template that should be used for the surround: + continue; + } + await commands.executeCommand(action.command.command, ...action.command.arguments); + await commands.executeCommand('undo'); + } + } + } + }).timeout(10000); + + // Tests explorer is loading properly + test("Test Explorer tests", async () => { + let folder: string = assertWorkspace(); + + try { + console.log("Test: load workspace tests"); + const workspaceFolder = (workspace.workspaceFolders!)[0]; + let tests: any = await commands.executeCommand("jdk.load.workspace.tests", workspaceFolder.uri.toString()); + console.log(`Test: load workspace tests finished with ${tests}`); + assert.ok(tests, "No tests returned for workspace"); + assert.strictEqual(tests.length, 2, `Invalid number of test suites returned`); + assert.strictEqual(tests[0].name, 'pkg.MainTest', `Invalid test suite name returned`); + assert.strictEqual(tests[0].tests.length, 1, `Invalid number of tests in suite returned`); + assert.strictEqual(tests[0].tests[0].name, 'testGetName', `Invalid test name returned`); + assert.strictEqual(tests[1].name, 'pkg.MainTest$NestedTest', `Invalid test suite name returned`); + assert.strictEqual(tests[1].tests.length, 1, `Invalid number of tests in suite returned`); + assert.strictEqual(tests[1].tests[0].name, 'testTrue', `Invalid test name returned`); + + console.log("Test: run all workspace tests"); + await vscode.commands.executeCommand(myExtension.COMMAND_PREFIX + '.run.test', workspaceFolder.uri.toString()); + console.log(`Test: run all workspace tests finished`); + } catch (error) { + dumpJava(); + throw error; + } + }).timeout(10000); + + // Check if compile workspace command is excuted succesfully + test("Compile workspace", async () => { + let folder: string = assertWorkspace(); + const compile = await commands.executeCommand('jdk.workspace.compile'); + assert.ok(compile, " Compile workspace command not working"); + + + const mainClass = path.join(folder, 'target', 'classes', 'pkg', 'Main.class'); + assert.ok(fs.statSync(mainClass).isFile(), "Class created by compilation: " + mainClass); + + myExplorer.createViewProvider(await myExtension.awaitClient(), "foundProjects").then(async (lvp) => { + const firstLevelChildren = await (lvp.getChildren() as Thenable); + assert.strictEqual(firstLevelChildren.length, 1, "One child under the root"); + const item = await (lvp.getTreeItem(firstLevelChildren[0]) as Thenable); + assert.strictEqual(item?.label, "basicapp", "Element is named as the Maven project"); + }); + }).timeout(10000); + + // Get Project info + test("Get project sources, classpath, and packages", async () => { + let folder: string = assertWorkspace(); + try { + console.log("Test: get project java source roots"); + let res: any = await commands.executeCommand("jdk.java.get.project.source.roots", Uri.file(folder).toString()); + console.log(`Test: get project java source roots finished with ${res}`); + assert.ok(res, "No java source root returned"); + assert.strictEqual(res.length, 2, `Invalid number of java roots returned`); + assert.strictEqual(path.join(res[0]).toLowerCase(), (path.join('file:', folder, 'src', 'main', 'java') + path.sep).toLowerCase(), `Invalid java main source root returned`); + assert.strictEqual(path.join(res[1]).toLowerCase(), (path.join('file:', folder, 'src', 'test', 'java') + path.sep).toLowerCase(), `Invalid java test source root returned`); + + console.log("Test: get project resource roots"); + res = await commands.executeCommand("jdk.java.get.project.source.roots", Uri.file(folder).toString(), 'resources'); + console.log(`Test: get project resource roots finished with ${res}`); + assert.ok(res, "No resource root returned"); + assert.strictEqual(res.length, 1, `Invalid number of resource roots returned`); + assert.strictEqual(path.join(res[0]).toLowerCase(), (path.join('file:', folder, 'src', 'main', 'resources') + path.sep).toLowerCase(), `Invalid resource root returned`); + + console.log("Test: get project compile classpath"); + res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString()); + console.log(`Test: get project compile classpath finished with ${res}`); + assert.ok(res, "No compile classpath returned"); + assert.strictEqual(res.length, 9, `Invalid number of compile classpath roots returned`); + assert.ok(res.find((item: string) => path.join(item).toLowerCase() === (path.join('file:', folder, 'target', 'classes') + path.sep).toLowerCase(), `Invalid compile classpath root returned`)); + + console.log("Test: get project source classpath"); + res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'SOURCE'); + console.log(`Test: get project source classpath finished with ${res}`); + assert.ok(res, "No source classpath returned"); + assert.strictEqual(res.length, 3, `Invalid number of source classpath roots returned`); + assert.ok(res.find((item: string) => path.join(item).toLowerCase() === (path.join('file:', folder, 'src', 'main', 'java') + path.sep).toLowerCase(), `Invalid source classpath root returned`)); + assert.ok(res.find((item: string) => path.join(item).toLowerCase() === (path.join('file:', folder, 'src', 'main', 'resources') + path.sep).toLowerCase(), `Invalid source classpath root returned`)); + assert.ok(res.find((item: string) => path.join(item).toLowerCase() === (path.join('file:', folder, 'src', 'test', 'java') + path.sep).toLowerCase(), `Invalid source classpath root returned`)); + + console.log("Test: get project boot classpath"); + res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'BOOT'); + console.log(`Test: get project boot classpath finished with ${res}`); + assert.ok(res, "No boot classpath returned"); + assert.ok(res.length > 0, `Invalid number of boot classpath roots returned`); + + console.log("Test: get project boot source classpath"); + res = await commands.executeCommand("jdk.java.get.project.classpath", Uri.file(folder).toString(), 'BOOT', true); + console.log(`Test: get project boot source classpath finished with ${res}`); + assert.ok(res, "No boot source classpath returned"); + assert.ok(res.length > 0, `Invalid number of boot source classpath roots returned`); + + console.log("Test: get all project packages"); + res = await commands.executeCommand("jdk.java.get.project.packages", Uri.file(folder).toString()); + console.log(`Test: get all project packages finished with ${res}`); + assert.ok(res, "No packages returned"); + assert.ok(res.length > 0, `Invalid number of packages returned`); + + console.log("Test: get project source packages"); + res = await commands.executeCommand("jdk.java.get.project.packages", Uri.file(folder).toString(), true); + console.log(`Test: get project source packages finished with ${res}`); + assert.ok(res, "No packages returned"); + assert.strictEqual(res.length, 1, `Invalid number of packages returned`); + assert.strictEqual(res[0], 'pkg', `Invalid package returned`); + } catch (error) { + dumpJava(); + throw error; + } + }).timeout(10000); + + // Check if clean workspace command is excuted succesfully + test("Clean workspace", async () => { + let folder: string = assertWorkspace(); + const clean = await commands.executeCommand('jdk.workspace.clean'); + assert.ok(clean, " Clean workspace command not working"); + + const mainClass = path.join(folder, 'target'); + assert.ok(!fs.existsSync(mainClass), "Class created by compilation: " + mainClass); + }).timeout(10000); + + // Check if xml document formatting is executed successfully + test("XML Format document", async () => { + const editor = await openFile(filePaths.pom); + await commands.executeCommand('editor.action.formatDocument'); + + const formattedContents = editor.document.getText().trim(); + assert.ok(formattedContents == FORMATTED_POM_XML.trim(), "pom.xml is not formatted"); + }).timeout(10000); + +}); \ No newline at end of file diff --git a/vscode/src/test/suite/index.ts b/vscode/src/test/suite/general/index.ts similarity index 55% rename from vscode/src/test/suite/index.ts rename to vscode/src/test/suite/general/index.ts index 6692190..ba3e49e 100644 --- a/vscode/src/test/suite/index.ts +++ b/vscode/src/test/suite/general/index.ts @@ -20,41 +20,8 @@ * under the License. */ -import * as path from 'path'; -import * as Mocha from 'mocha'; -import * as glob from 'glob'; +import { runTestSuite } from '../../testutils'; export function run(): Promise { - // Create the mocha test - const mocha = new Mocha({ - ui: 'tdd', - color: true, - timeout: 60000 - }); - - const testsRoot = path.resolve(__dirname, '..'); - - return new Promise((c, e) => { - glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { - if (err) { - return e(err); - } - // Add files to the test suite - files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); - - try { - // Run the mocha test - mocha.run(failures => { - if (failures > 0) { - e(new Error(`${failures} tests failed.`)); - } else { - c(); - } - }); - } catch (err) { - console.error(err); - e(err); - } - }); - }); + return runTestSuite(__dirname); } \ No newline at end of file diff --git a/vscode/src/test/ws/empty.ts b/vscode/src/test/suite/general/ws/empty.ts similarity index 100% rename from vscode/src/test/ws/empty.ts rename to vscode/src/test/suite/general/ws/empty.ts diff --git a/vscode/src/test/suite/gradle/extension.test.ts b/vscode/src/test/suite/gradle/extension.test.ts new file mode 100644 index 0000000..f7fa1a9 --- /dev/null +++ b/vscode/src/test/suite/gradle/extension.test.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* This file has been modified for Oracle Java SE extension */ + +import * as assert from "assert"; +import * as fs from "fs"; +import * as path from "path"; + +import { commands, window } from "vscode"; +import { assertWorkspace, dumpJava, gradleInitJavaApplication } from "../../testutils"; + + +suite("Extension gradle tests", function () { + window.showInformationMessage("Starting Gradle tests"); + + // Check if compile workspace command is excuted succesfully + test("Compile workspace - Gradle ", async () => { + let folder: string = assertWorkspace(); + try { + await gradleInitJavaApplication(folder); + let compile = await commands.executeCommand("jdk.workspace.compile"); + assert.ok(compile, " Compile workspace command not working"); + const mainClass = path.join( + folder, + "build", + "classes", + "java", + "main", + "org", + "yourCompany", + "yourProject", + "App.class" + ); + assert.ok( + fs.statSync(mainClass).isFile(), + "Class created by compilation: " + mainClass + ); + } catch (error) { + dumpJava(); + throw error; + } + }).timeout(50000); + + // Check if clean workspace command is excuted succesfully + test("Clean workspace - Gradle", async () => { + let folder: string = assertWorkspace(); + const clean = await commands.executeCommand("jdk.workspace.clean"); + assert.ok(clean, " Clean workspace command not working"); + + const mainClass = path.join(folder, "build"); + assert.ok( + !fs.existsSync(mainClass), + "Class created by compilation: " + mainClass + ); + }).timeout(10000); +}); diff --git a/vscode/src/test/suite/gradle/index.ts b/vscode/src/test/suite/gradle/index.ts new file mode 100644 index 0000000..cba4643 --- /dev/null +++ b/vscode/src/test/suite/gradle/index.ts @@ -0,0 +1,26 @@ + +/* + * Copyright (c) 2023, Oracle and/or its affiliates. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { runTestSuite } from '../../testutils'; + +export function run(): Promise { + return runTestSuite(__dirname); +} \ No newline at end of file diff --git a/vscode/src/test/suite/gradle/ws/empty.ts b/vscode/src/test/suite/gradle/ws/empty.ts new file mode 100644 index 0000000..2744cd3 --- /dev/null +++ b/vscode/src/test/suite/gradle/ws/empty.ts @@ -0,0 +1,21 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export function empty(): any { +} diff --git a/vscode/src/test/suite/testutils.ts b/vscode/src/test/suite/testutils.ts deleted file mode 100644 index 3aa4053..0000000 --- a/vscode/src/test/suite/testutils.ts +++ /dev/null @@ -1,194 +0,0 @@ - -/* - * Copyright (c) 2023, Oracle and/or its affiliates. - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* This file has been modified for Oracle Java SE extension */ - -import * as assert from 'assert'; -import * as vscode from 'vscode'; -import * as fs from 'fs'; -import * as myExtension from '../../extension'; -import * as path from 'path'; -import { spawn, ChildProcessByStdio } from 'child_process'; -import { Readable } from 'stream'; -import { EXAMPLE_POM, MAIN_JAVA, MAIN_TEST_JAVA, SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_REFACTOR, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS } from './constants'; - -/** - * Folder path currently opened in VSCode workspace - * @returns String containing the folder path of the workspace - */ -export function assertWorkspace(): string { - assert.ok(vscode.workspace, "workspace is defined"); - const dirs = vscode.workspace.workspaceFolders; - assert.ok(dirs?.length, "There are some workspace folders: " + dirs); - assert.strictEqual(dirs.length, 1, "One folder provided"); - let folder: string = dirs[0].uri.fsPath; - - return folder; -} - -/** - * File paths of all the files and folders usd for testing - * @returns Object containing all the file and folder paths - */ -export function getFilePaths(): { [key: string]: string } { - let folder: string = assertWorkspace(); - - const filePaths: { [key: string]: string } = {}; - filePaths['pkg'] = path.join(folder, 'src', 'main', 'java', 'pkg'); - filePaths['testPkg'] = path.join(folder, 'src', 'test', 'java', 'pkg'); - filePaths['resources'] = path.join(folder, 'src', 'main', 'resources'); - - filePaths['mainJava'] = path.join(filePaths['pkg'], 'Main.java'); - filePaths['formatDocument'] = path.join(filePaths['pkg'], 'FormatDocument.java'); - filePaths['sortImports'] = path.join(filePaths['pkg'], 'SortImports.java'); - filePaths['unusedImports'] = path.join(filePaths['pkg'], 'UnusedImports.java'); - filePaths['refactorActions'] = path.join(filePaths['pkg'], 'RefactorActions.java'); - filePaths['mainTestJava'] = path.join(filePaths['testPkg'], 'MainTest.java'); - - filePaths['pom'] = path.join(folder, 'pom.xml'); - - return filePaths; -} - -/** - * Prepares the sample project for testing - * @param filePaths - * @returns promise that waits till all the files and folders are created - */ -export async function prepareProject(filePaths: { [key: string]: string }): Promise { - await fs.promises.writeFile(filePaths['pom'], EXAMPLE_POM); - - await fs.promises.mkdir(filePaths['pkg'], { recursive: true }); - await fs.promises.mkdir(filePaths['resources'], { recursive: true }); - await fs.promises.mkdir(filePaths['testPkg'], { recursive: true }); - - await fs.promises.writeFile(filePaths['mainJava'], MAIN_JAVA); - - await fs.promises.writeFile(filePaths['mainTestJava'], MAIN_TEST_JAVA); - await vscode.workspace.saveAll(); - - await fs.promises.writeFile(filePaths['formatDocument'], SAMPLE_CODE_FORMAT_DOCUMENT); - await fs.promises.writeFile(filePaths['sortImports'], SAMPLE_CODE_SORT_IMPORTS); - await fs.promises.writeFile(filePaths['unusedImports'], SAMPLE_CODE_UNUSED_IMPORTS); - await fs.promises.writeFile(filePaths['refactorActions'], SAMPLE_CODE_REFACTOR); - - await waitProjectRecognized(filePaths.mainJava); -} - -/** - * Wait till all the commands of the extension are loaded - * @returns promise that timeouts till all the commands are loaded - */ -export async function waitCommandsReady(): Promise { - return new Promise((resolve, reject) => { - function checkCommands(attempts: number, cb: () => void) { - try { - // this command is parameterless - vscode.commands.executeCommand("jdk.java.attachDebugger.configurations") - console.log("JDK commands ready."); - resolve(); - } catch (e) { - if (attempts > 0) { - console.log("Waiting for JDK commands to be registered, " + attempts + " attempts to go..."); - setTimeout(() => checkCommands(attempts - 1, cb), 100); - } else { - reject(new Error("Timeout waiting for JDK commands registration: " + e)); - } - } - } - myExtension.awaitClient().then(() => checkCommands(5, () => { })); - }); -} - - -/** - * Ensures that the project that holds the parameter file was opened in JDK. - * @param someJavaFile - * @returns promise that will be fullfilled after the project opens in JDK. - */ -async function waitProjectRecognized(someJavaFile: string): Promise { - return waitCommandsReady().then(() => { - const u: vscode.Uri = vscode.Uri.file(someJavaFile); - // clear out possible bad or negative caches. - return vscode.commands.executeCommand(myExtension.COMMAND_PREFIX + ".clear.project.caches").then( - // this should assure opening the root with the created project. - () => vscode.commands.executeCommand(myExtension.COMMAND_PREFIX + ".java.get.project.packages", u.toString()) - ); - }); -} - - -/** - * Replaces code in editor with the provided code - * @param editor - * @param code - * @returns promise that will have replaced code in the editor - */ -export async function replaceCode(editor: vscode.TextEditor | undefined, code: string): Promise { - const doc = editor?.document; - assert(doc !== undefined, 'editor cannot be initialzed'); - - const range = new vscode.Range(doc.lineAt(0).range.start, doc.lineAt(doc.lineCount - 1).range.end) - - await editor?.edit(editBuilder => { - editBuilder.replace(range, code); - }); -} - -/** - * Opens a file in VScode workspace - * @param filePath - * @returns promise that contains instance of the editor opened - */ -export async function openFile(filePath: string): Promise { - const document: vscode.TextDocument = await vscode.workspace.openTextDocument(vscode.Uri.file(filePath)); - await vscode.window.showTextDocument(document); - const editor = vscode.window.activeTextEditor; - assert(editor !== undefined, 'editor cannot be initialzed'); - - return editor; -} - -/** - * If some error is encountered in the tests then it dumps java process - * @returns promise that dumps the java process - */ -export async function dumpJava(): Promise { - const cmd = 'jps'; - const args = ['-v']; - console.log(`Running: ${cmd} ${args.join(' ')}`); - let p: ChildProcessByStdio = spawn(cmd, args, { - stdio: ["ignore", "pipe", "pipe"], - }); - let n = await new Promise((r, e) => { - p.stdout.on('data', function (d: any) { - console.log(d.toString()); - }); - p.stderr.on('data', function (d: any) { - console.log(d.toString()); - }); - p.on('close', function (code: number) { - r(code); - }); - }); - console.log(`${cmd} ${args.join(' ')} finished with code ${n}`); -} diff --git a/vscode/src/test/testutils.ts b/vscode/src/test/testutils.ts new file mode 100644 index 0000000..493d748 --- /dev/null +++ b/vscode/src/test/testutils.ts @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* This file has been modified for Oracle Java SE extension */ + +import * as assert from "assert"; +import * as fs from "fs"; +import * as glob from 'glob'; +import * as myExtension from "../extension"; +import * as Mocha from 'mocha'; +import * as path from "path"; +import { promisify } from "util"; +import { Readable } from "stream"; +import { spawn, ChildProcessByStdio, exec } from "child_process"; +import * as vscode from "vscode"; +import { EXAMPLE_POM, MAIN_JAVA, MAIN_TEST_JAVA, SAMPLE_APP_JAVA, SAMPLE_BUILD_GRADLE, SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_REFACTOR, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS, SAMPLE_SETTINGS_GRADLE } from "./constants"; + +/** + * Folder path currently opened in VSCode workspace + * @returns String containing the folder path of the workspace + */ +export function assertWorkspace(): string { + assert.ok(vscode.workspace, "workspace is defined"); + const dirs = vscode.workspace.workspaceFolders; + assert.ok(dirs?.length, "There are some workspace folders: " + dirs); + assert.strictEqual(dirs.length, 1, "One folder provided"); + let folder: string = dirs[0].uri.fsPath; + return folder; +} + +/** + * File paths of all the files and folders usd for testing + * @returns Object containing all the file and folder paths + */ +export function getFilePaths(): { [key: string]: string } { + let folder: string = assertWorkspace(); + + const filePaths: { [key: string]: string } = {}; + filePaths["pkg"] = path.join(folder, "src", "main", "java", "pkg"); + filePaths["testPkg"] = path.join(folder, "src", "test", "java", "pkg"); + filePaths["resources"] = path.join(folder, "src", "main", "resources"); + + filePaths["mainJava"] = path.join(filePaths["pkg"], "Main.java"); + filePaths["formatDocument"] = path.join( + filePaths["pkg"], + "FormatDocument.java" + ); + filePaths["sortImports"] = path.join(filePaths["pkg"], "SortImports.java"); + filePaths["unusedImports"] = path.join( + filePaths["pkg"], + "UnusedImports.java" + ); + filePaths["refactorActions"] = path.join( + filePaths["pkg"], + "RefactorActions.java" + ); + filePaths["mainTestJava"] = path.join(filePaths["testPkg"], "MainTest.java"); + + filePaths["pom"] = path.join(folder, "pom.xml"); + + return filePaths; +} + +/** + * Prepares the sample project for testing + * @param filePaths + * @returns promise that waits till all the files and folders are created + */ +export async function prepareProject(filePaths: { + [key: string]: string; +}): Promise { + await fs.promises.writeFile(filePaths["pom"], EXAMPLE_POM); + + await fs.promises.mkdir(filePaths["pkg"], { recursive: true }); + await fs.promises.mkdir(filePaths["resources"], { recursive: true }); + await fs.promises.mkdir(filePaths["testPkg"], { recursive: true }); + + await fs.promises.writeFile(filePaths["mainJava"], MAIN_JAVA); + + await fs.promises.writeFile(filePaths["mainTestJava"], MAIN_TEST_JAVA); + await vscode.workspace.saveAll(); + + await fs.promises.writeFile( + filePaths["formatDocument"], + SAMPLE_CODE_FORMAT_DOCUMENT + ); + await fs.promises.writeFile( + filePaths["sortImports"], + SAMPLE_CODE_SORT_IMPORTS + ); + await fs.promises.writeFile( + filePaths["unusedImports"], + SAMPLE_CODE_UNUSED_IMPORTS + ); + await fs.promises.writeFile( + filePaths["refactorActions"], + SAMPLE_CODE_REFACTOR + ); + + await waitProjectRecognized(filePaths.mainJava); +} + +/** + * Wait till all the commands of the extension are loaded + * @returns promise that timeouts till all the commands are loaded + */ +export async function waitCommandsReady(): Promise { + return new Promise((resolve, reject) => { + function checkCommands(attempts: number, cb: () => void) { + try { + // this command is parameterless + vscode.commands.executeCommand( + "jdk.java.attachDebugger.configurations" + ); + console.log("JDK commands ready."); + resolve(); + } catch (e) { + if (attempts > 0) { + console.log( + "Waiting for JDK commands to be registered, " + + attempts + + " attempts to go..." + ); + setTimeout(() => checkCommands(attempts - 1, cb), 100); + } else { + reject( + new Error("Timeout waiting for JDK commands registration: " + e) + ); + } + } + } + myExtension.awaitClient().then(() => checkCommands(5, () => { })); + }); +} + +/** + * Ensures that the project that holds the parameter file was opened in JDK. + * @param someJavaFile + * @returns promise that will be fullfilled after the project opens in JDK. + */ +export async function waitProjectRecognized(someJavaFile: string): Promise { + return waitCommandsReady().then(() => { + const u: vscode.Uri = vscode.Uri.file(someJavaFile); + // clear out possible bad or negative caches. + return vscode.commands + .executeCommand(myExtension.COMMAND_PREFIX + ".clear.project.caches") + .then( + // this should assure opening the root with the created project. + () => + vscode.commands.executeCommand( + myExtension.COMMAND_PREFIX + ".java.get.project.packages", + u.toString() + ) + ); + }); +} + +/** + * Replaces code in editor with the provided code + * @param editor + * @param code + * @returns promise that will have replaced code in the editor + */ +export async function replaceCode( + editor: vscode.TextEditor | undefined, + code: string +): Promise { + const doc = editor?.document; + assert(doc !== undefined, "editor cannot be initialzed"); + + const range = new vscode.Range( + doc.lineAt(0).range.start, + doc.lineAt(doc.lineCount - 1).range.end + ); + + await editor?.edit((editBuilder) => { + editBuilder.replace(range, code); + }); +} + +/** + * Opens a file in VScode workspace + * @param filePath + * @returns promise that contains instance of the editor opened + */ +export async function openFile(filePath: string): Promise { + const document: vscode.TextDocument = await vscode.workspace.openTextDocument( + vscode.Uri.file(filePath) + ); + await vscode.window.showTextDocument(document); + const editor = vscode.window.activeTextEditor; + assert(editor !== undefined, "editor cannot be initialzed"); + + return editor; +} + +/** + * If some error is encountered in the tests then it dumps java process + * @returns promise that dumps the java process + */ +export async function dumpJava(): Promise { + const cmd = "jps"; + const args = ["-v"]; + console.log(`Running: ${cmd} ${args.join(" ")}`); + let p: ChildProcessByStdio = spawn(cmd, args, { + stdio: ["ignore", "pipe", "pipe"], + }); + let n = await new Promise((r, e) => { + p.stdout.on("data", function (d: any) { + console.log(d.toString()); + }); + p.stderr.on("data", function (d: any) { + console.log(d.toString()); + }); + p.on("close", function (code: number) { + r(code); + }); + }); + console.log(`${cmd} ${args.join(" ")} finished with code ${n}`); +} + +export const runShellCommand = async (command: string, folderPath: string) => { + console.log(`commaned being executed: ${command}`); + const shellExec = promisify(exec); + const { stdout, stderr } = await shellExec(command, { cwd: folderPath }); + console.log(stdout); + console.error(stderr); +}; + +export async function gradleInitJavaApplication(folder: string) { + const basePackage = "org.yourCompany.yourProject"; + + const projectPath = path.join(folder); + const srcMainPath = path.join( + projectPath, + "src", + "main", + "java", + ...basePackage.split(".") + ); + const resourcesPath = path.join(projectPath, "src", "main", "resources"); + const testPath = path.join( + projectPath, + "src", + "test", + "java", + ...basePackage.split(".") + ); + + try { + // Create directories + await fs.promises.mkdir(projectPath, { recursive: true }); + await fs.promises.mkdir(srcMainPath, { recursive: true }); + await fs.promises.mkdir(resourcesPath, { recursive: true }); + await fs.promises.mkdir(testPath, { recursive: true }); + + // Create build.gradle & settings.gradle files + await fs.promises.writeFile( + path.join(projectPath, "build.gradle"), + SAMPLE_BUILD_GRADLE + ); + await fs.promises.writeFile( + path.join(projectPath, "settings.gradle"), + SAMPLE_SETTINGS_GRADLE + ); + // Create Java main file + await fs.promises.writeFile( + path.join(srcMainPath, "App.java"), + SAMPLE_APP_JAVA + ); + + await waitProjectRecognized(path.join(srcMainPath, "App.java")); + + } catch (error) { + throw error; + } +}; + +export function runTestSuite(folder: string): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: 'tdd', + color: true, + timeout: 10*1000*60 + }); + + const testsRoot = path.resolve(folder); + + return new Promise((c, e) => { + glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { + if (err) { + return e(err); + } + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + console.error(err); + e(err); + } + }); + }); +}