From bb61ddaf579a7814a57afc668edf7d81901c758c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 14 Jan 2023 20:45:31 +0100 Subject: [PATCH 1/6] move tests outside --- {src/test => test}/runTest.ts | 0 {src/test => test}/suite/extension.test.ts | 0 {src/test => test}/suite/index.ts | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {src/test => test}/runTest.ts (100%) rename {src/test => test}/suite/extension.test.ts (100%) rename {src/test => test}/suite/index.ts (100%) diff --git a/src/test/runTest.ts b/test/runTest.ts similarity index 100% rename from src/test/runTest.ts rename to test/runTest.ts diff --git a/src/test/suite/extension.test.ts b/test/suite/extension.test.ts similarity index 100% rename from src/test/suite/extension.test.ts rename to test/suite/extension.test.ts diff --git a/src/test/suite/index.ts b/test/suite/index.ts similarity index 100% rename from src/test/suite/index.ts rename to test/suite/index.ts From 1084c97f7b40e2f4996390c914f194df69c91fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 14 Jan 2023 20:45:45 +0100 Subject: [PATCH 2/6] remove playground folder --- playground/index.php | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 playground/index.php diff --git a/playground/index.php b/playground/index.php deleted file mode 100644 index d023acb..0000000 --- a/playground/index.php +++ /dev/null @@ -1,6 +0,0 @@ - 'world', - 'foo' => 'bar' -]; \ No newline at end of file From 2c53459b78ab0f815f528fec73a77c9bcfd4e40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 14 Jan 2023 20:46:49 +0100 Subject: [PATCH 3/6] add playground repo as submodule --- .gitmodules | 3 +++ playground | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 playground diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a494bef --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "playground"] + path = playground + url = https://github.com/open-southeners/vscode-laravel-pint-playground.git diff --git a/playground b/playground new file mode 160000 index 0000000..5f212c9 --- /dev/null +++ b/playground @@ -0,0 +1 @@ +Subproject commit 5f212c978db0273bb29de7a3975fdf8bacde596e From 2fa0b31c87f2df37358312ccafba8f761f912531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 14 Jan 2023 21:16:47 +0100 Subject: [PATCH 4/6] update dependencies --- package.json | 16 +- yarn.lock | 691 +++++++++++++++++++++++++-------------------------- 2 files changed, 345 insertions(+), 362 deletions(-) diff --git a/package.json b/package.json index 6a98f2c..6e5e79b 100644 --- a/package.json +++ b/package.json @@ -138,19 +138,19 @@ "@types/mocha": "^9.1.1", "@types/node": "14.x", "@types/vscode": "^1.68.0", - "@typescript-eslint/eslint-plugin": "^5.12.1", - "@typescript-eslint/parser": "^5.12.1", - "@vscode/test-electron": "^2.1.2", + "@typescript-eslint/eslint-plugin": "^5.48.1", + "@typescript-eslint/parser": "^5.48.1", + "@vscode/test-electron": "^2.2.2", + "@vscode/vsce": "^2.16.0", "command-exists": "^1.2.9", - "esbuild": "^0.15.15", - "eslint": "^8.28.0", + "esbuild": "^0.17.0", + "eslint": "^8.31.0", "fs-extra": "^10.1.0", "glob": "^8.0.3", "mocha": "^9.2.2", "node-fetch": "^3.3.0", - "ovsx": "^0.5.2", - "typescript": "^4.9.3", - "vsce": "^2.14.0" + "ovsx": "^0.8.0", + "typescript": "^4.9.4" }, "engines": { "vscode": "^1.68.0" diff --git a/yarn.lock b/yarn.lock index be36d08..26ea668 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,34 +5,174 @@ __metadata: version: 6 cacheKey: 8 -"@esbuild/android-arm@npm:0.15.15": - version: 0.15.15 - resolution: "@esbuild/android-arm@npm:0.15.15" +"@esbuild/android-arm64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/android-arm64@npm:0.17.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/android-arm@npm:0.17.0" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.15.15": - version: 0.15.15 - resolution: "@esbuild/linux-loong64@npm:0.15.15" +"@esbuild/android-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/android-x64@npm:0.17.0" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/darwin-arm64@npm:0.17.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/darwin-x64@npm:0.17.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/freebsd-arm64@npm:0.17.0" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/freebsd-x64@npm:0.17.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-arm64@npm:0.17.0" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-arm@npm:0.17.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-ia32@npm:0.17.0" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-loong64@npm:0.17.0" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@eslint/eslintrc@npm:^1.3.3": - version: 1.3.3 - resolution: "@eslint/eslintrc@npm:1.3.3" +"@esbuild/linux-mips64el@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-mips64el@npm:0.17.0" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-ppc64@npm:0.17.0" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-riscv64@npm:0.17.0" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-s390x@npm:0.17.0" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/linux-x64@npm:0.17.0" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/netbsd-x64@npm:0.17.0" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/openbsd-x64@npm:0.17.0" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/sunos-x64@npm:0.17.0" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/win32-arm64@npm:0.17.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/win32-ia32@npm:0.17.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.17.0": + version: 0.17.0 + resolution: "@esbuild/win32-x64@npm:0.17.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@eslint/eslintrc@npm:^1.4.1": + version: 1.4.1 + resolution: "@eslint/eslintrc@npm:1.4.1" dependencies: ajv: ^6.12.4 debug: ^4.3.2 espree: ^9.4.0 - globals: ^13.15.0 + globals: ^13.19.0 ignore: ^5.2.0 import-fresh: ^3.2.1 js-yaml: ^4.1.0 minimatch: ^3.1.2 strip-json-comments: ^3.1.1 - checksum: f03e9d6727efd3e0719da2051ea80c0c73d20e28c171121527dbb868cd34232ca9c1d0525a66e517a404afea26624b1e47895b6a92474678418c2f50c9566694 + checksum: cd3e5a8683db604739938b1c1c8b77927dc04fce3e28e0c88e7f2cd4900b89466baf83dfbad76b2b9e4d2746abdd00dd3f9da544d3e311633d8693f327d04cd7 languageName: node linkType: hard @@ -43,14 +183,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.6": - version: 0.11.7 - resolution: "@humanwhocodes/config-array@npm:0.11.7" +"@humanwhocodes/config-array@npm:^0.11.8": + version: 0.11.8 + resolution: "@humanwhocodes/config-array@npm:0.11.8" dependencies: "@humanwhocodes/object-schema": ^1.2.1 debug: ^4.1.1 minimatch: ^3.0.5 - checksum: cf506dc45d9488af7fbf108ea6ac2151ba1a25e6d2b94b9b4fc36d2c1e4099b89ff560296dbfa13947e44604d4ca4a90d97a4fb167370bf8dd01a6ca2b6d83ac + checksum: 0fd6b3c54f1674ce0a224df09b9c2f9846d20b9e54fabae1281ecfc04f2e6ad69bf19e1d6af6a28f88e8aa3990168b6cb9e1ef755868c3256a630605ec2cb1d3 languageName: node linkType: hard @@ -190,6 +330,13 @@ __metadata: languageName: node linkType: hard +"@types/semver@npm:^7.3.12": + version: 7.3.13 + resolution: "@types/semver@npm:7.3.13" + checksum: 00c0724d54757c2f4bc60b5032fe91cda6410e48689633d5f35ece8a0a66445e3e57fa1d6e07eb780f792e82ac542948ec4d0b76eb3484297b79bd18b8cf1cb0 + languageName: node + linkType: hard + "@types/vscode@npm:^1.68.0": version: 1.73.1 resolution: "@types/vscode@npm:1.73.1" @@ -197,16 +344,16 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.12.1": - version: 5.29.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.29.0" +"@typescript-eslint/eslint-plugin@npm:^5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/eslint-plugin@npm:5.48.1" dependencies: - "@typescript-eslint/scope-manager": 5.29.0 - "@typescript-eslint/type-utils": 5.29.0 - "@typescript-eslint/utils": 5.29.0 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/type-utils": 5.48.1 + "@typescript-eslint/utils": 5.48.1 debug: ^4.3.4 - functional-red-black-tree: ^1.0.1 ignore: ^5.2.0 + natural-compare-lite: ^1.4.0 regexpp: ^3.2.0 semver: ^7.3.7 tsutils: ^3.21.0 @@ -216,42 +363,43 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: b1022a640f80c314ac8b247a2ccdd21f4b523b3cb8906956f5d276008ac964c8a1e951b2b2b16ca9621eb795dc9bbf6447b5b767acfe4866a1bc3e3527d966fc + checksum: d8d73d123d16fc9b50b500ef21816dcabdffe0d2dcfdb15089dc5a1015d57cbad709de565d1c830f5058c0d7b410069e2554c0b53d1485fe7b237ea8089e58be languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.12.1": - version: 5.29.0 - resolution: "@typescript-eslint/parser@npm:5.29.0" +"@typescript-eslint/parser@npm:^5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/parser@npm:5.48.1" dependencies: - "@typescript-eslint/scope-manager": 5.29.0 - "@typescript-eslint/types": 5.29.0 - "@typescript-eslint/typescript-estree": 5.29.0 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/typescript-estree": 5.48.1 debug: ^4.3.4 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 7805796638d1ddbe21f2627e9f03493ec17710e22ae81d2345f3e0f5ff9cbf6f0cd1b0e05d8d0b9aa08435bafdb6b5c86f27d7115f0959de43e3322b86c00709 + checksum: c624d24eb209b4ce7f0a6c8116712363f10a9c9a5138f240e254ff265526ee4b0fd73b7b6b4b6a0e7611bd9934c42036350dd27f96ae2fa4efdade1a7ebd0e9e languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/scope-manager@npm:5.29.0" +"@typescript-eslint/scope-manager@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/scope-manager@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.29.0 - "@typescript-eslint/visitor-keys": 5.29.0 - checksum: 540642bef9c55fd7692af98dfb42ab99eeb82553f42ab2a3c4e132e02b5ba492da1c6bf1ca6b02b900a678fc74399ad6c564c0ca20d91032090b6cbcb01a5bde + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/visitor-keys": 5.48.1 + checksum: f60a7efe917798cccf8652925de6be58b023ded6c6ee44ce74d074f0c2a1927680398a6d73bab33d500c69474ad8c54d63b90fcc6e13256712707d12a60e0a64 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/type-utils@npm:5.29.0" +"@typescript-eslint/type-utils@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/type-utils@npm:5.48.1" dependencies: - "@typescript-eslint/utils": 5.29.0 + "@typescript-eslint/typescript-estree": 5.48.1 + "@typescript-eslint/utils": 5.48.1 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -259,23 +407,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 686b8ff05a7591f76a2a1d3746b988168dcbd59c2f52de095b19e4f8e17063e03dc3d0f7b3d84f7be6880f2df97c3e184877664d0b4275ea9871c31d1e58c7d2 + checksum: 2739b35caf48c9edbeab82936de58ce0759ab34955ce7eec1786690d6a63146ae0a6c5d9c76034605d9fe200c87a73ede0772c6244c5df6e66df992d9ebbab72 languageName: node linkType: hard -"@typescript-eslint/types@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/types@npm:5.29.0" - checksum: 982ecdd69103105cabff8deac7f82f6002cf909238702ce902133e9af655cd962f977d5adf650c5ddae80d8c0e46abe1612a9141b25c7ed20ba8d662eb7ab871 +"@typescript-eslint/types@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/types@npm:5.48.1" + checksum: 8437986e9d86d792b23327517ae2f9861ec55992d5a9cd55991e525409b6244169436cd708f3987ab7c579e45e59b6eab5a9d3583f7729219e25691164293094 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.29.0" +"@typescript-eslint/typescript-estree@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/typescript-estree@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.29.0 - "@typescript-eslint/visitor-keys": 5.29.0 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/visitor-keys": 5.48.1 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -284,33 +432,35 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: b91107a9fc31bf511aaa70f1e6d1d832d3acf08cfe999c870169447a7c223abff54c1d604bbb08d7c069dd98b43fb279bc314d1726097704fe8ad4c6e0969b12 + checksum: 2b26e5848ef131e1bb99ed54d8c0efa8279cf8e8f7d8b72de00c2ca6cf2799d96c20f5bbbcf26e14e81b7b9d1035ba509bff30f2d852c174815879e8f14c27ed languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/utils@npm:5.29.0" +"@typescript-eslint/utils@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/utils@npm:5.48.1" dependencies: "@types/json-schema": ^7.0.9 - "@typescript-eslint/scope-manager": 5.29.0 - "@typescript-eslint/types": 5.29.0 - "@typescript-eslint/typescript-estree": 5.29.0 + "@types/semver": ^7.3.12 + "@typescript-eslint/scope-manager": 5.48.1 + "@typescript-eslint/types": 5.48.1 + "@typescript-eslint/typescript-estree": 5.48.1 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 + semver: ^7.3.7 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 216f51fb9c176437919af55db9ed14db8af7b020611e954c06e69956b9e3248cbfe6a218013d6c17b716116dca6566a4c03710f9b48ce4e94f89312d61c16d07 + checksum: 2d112cbb6a920f147c6c3322e404ca3c56c1170e1ede3bcbf16fb779960dc24cdba688b1f2d06acd242859fc1dbc8702da5f8fa8bbf53e7081e41d80bec4c236 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.29.0": - version: 5.29.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.29.0" +"@typescript-eslint/visitor-keys@npm:5.48.1": + version: 5.48.1 + resolution: "@typescript-eslint/visitor-keys@npm:5.48.1" dependencies: - "@typescript-eslint/types": 5.29.0 + "@typescript-eslint/types": 5.48.1 eslint-visitor-keys: ^3.3.0 - checksum: 15f228ad9ffaf0e42cc6b2ee4e5095c1e89c4c2dc46a65d19ca0e2296d88c08a1192039d942bd9600b1496176749f6322d636dd307602dbab90404a9501b4d6e + checksum: 2bda10cf4e6bc48b0d463767617e48a832d708b9434665dff6ed101f7d33e0d592f02af17a2259bde1bd17e666246448ae78d0fe006148cb93d897fff9b1d134 languageName: node linkType: hard @@ -321,15 +471,48 @@ __metadata: languageName: node linkType: hard -"@vscode/test-electron@npm:^2.1.2": - version: 2.1.4 - resolution: "@vscode/test-electron@npm:2.1.4" +"@vscode/test-electron@npm:^2.2.2": + version: 2.2.2 + resolution: "@vscode/test-electron@npm:2.2.2" dependencies: http-proxy-agent: ^4.0.1 https-proxy-agent: ^5.0.0 rimraf: ^3.0.2 unzipper: ^0.10.11 - checksum: 2a541f70689cfdbfd911884caeba2fabf0bfeede4ee11b77bd97e8bd4bb6388341c7785230a05696b590e9aa6513d29b18ce82cc85965e664710ce4decc19b03 + checksum: 0985ee3c604e1d098800219be3dfc5bbb11f6578f41888d7b80a9dacdcbe08d683bbba439559cc8519f728455df8e49daae976d03f0e57ad8786da8e222c75d8 + languageName: node + linkType: hard + +"@vscode/vsce@npm:^2.15.0, @vscode/vsce@npm:^2.16.0": + version: 2.16.0 + resolution: "@vscode/vsce@npm:2.16.0" + dependencies: + azure-devops-node-api: ^11.0.1 + chalk: ^2.4.2 + cheerio: ^1.0.0-rc.9 + commander: ^6.1.0 + glob: ^7.0.6 + hosted-git-info: ^4.0.2 + keytar: ^7.7.0 + leven: ^3.1.0 + markdown-it: ^12.3.2 + mime: ^1.3.4 + minimatch: ^3.0.3 + parse-semver: ^1.1.1 + read: ^1.0.7 + semver: ^5.1.0 + tmp: ^0.2.1 + typed-rest-client: ^1.8.4 + url-join: ^4.0.1 + xml2js: ^0.4.23 + yauzl: ^2.3.1 + yazl: ^2.2.2 + dependenciesMeta: + keytar: + optional: true + bin: + vsce: vsce + checksum: dcab780b75292637d5c916f98f4e4d110e2dd8285fb7fae1d36d47cb4c5da6db2b6bc509f5b9e73ed3b8c4543ab3ba3dcb86b368404dfd15b7a474a34b7a9071 languageName: node linkType: hard @@ -1094,220 +1277,80 @@ __metadata: languageName: node linkType: hard -"esbuild-android-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-android-64@npm:0.15.15" - conditions: os=android & cpu=x64 - languageName: node - linkType: hard - -"esbuild-android-arm64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-android-arm64@npm:0.15.15" - conditions: os=android & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-darwin-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-darwin-64@npm:0.15.15" - conditions: os=darwin & cpu=x64 - languageName: node - linkType: hard - -"esbuild-darwin-arm64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-darwin-arm64@npm:0.15.15" - conditions: os=darwin & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-freebsd-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-freebsd-64@npm:0.15.15" - conditions: os=freebsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-freebsd-arm64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-freebsd-arm64@npm:0.15.15" - conditions: os=freebsd & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-linux-32@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-32@npm:0.15.15" - conditions: os=linux & cpu=ia32 - languageName: node - linkType: hard - -"esbuild-linux-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-64@npm:0.15.15" - conditions: os=linux & cpu=x64 - languageName: node - linkType: hard - -"esbuild-linux-arm64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-arm64@npm:0.15.15" - conditions: os=linux & cpu=arm64 - languageName: node - linkType: hard - -"esbuild-linux-arm@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-arm@npm:0.15.15" - conditions: os=linux & cpu=arm - languageName: node - linkType: hard - -"esbuild-linux-mips64le@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-mips64le@npm:0.15.15" - conditions: os=linux & cpu=mips64el - languageName: node - linkType: hard - -"esbuild-linux-ppc64le@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-ppc64le@npm:0.15.15" - conditions: os=linux & cpu=ppc64 - languageName: node - linkType: hard - -"esbuild-linux-riscv64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-riscv64@npm:0.15.15" - conditions: os=linux & cpu=riscv64 - languageName: node - linkType: hard - -"esbuild-linux-s390x@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-linux-s390x@npm:0.15.15" - conditions: os=linux & cpu=s390x - languageName: node - linkType: hard - -"esbuild-netbsd-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-netbsd-64@npm:0.15.15" - conditions: os=netbsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-openbsd-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-openbsd-64@npm:0.15.15" - conditions: os=openbsd & cpu=x64 - languageName: node - linkType: hard - -"esbuild-sunos-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-sunos-64@npm:0.15.15" - conditions: os=sunos & cpu=x64 - languageName: node - linkType: hard - -"esbuild-windows-32@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-windows-32@npm:0.15.15" - conditions: os=win32 & cpu=ia32 - languageName: node - linkType: hard - -"esbuild-windows-64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-windows-64@npm:0.15.15" - conditions: os=win32 & cpu=x64 - languageName: node - linkType: hard - -"esbuild-windows-arm64@npm:0.15.15": - version: 0.15.15 - resolution: "esbuild-windows-arm64@npm:0.15.15" - conditions: os=win32 & cpu=arm64 - languageName: node - linkType: hard - -"esbuild@npm:^0.15.15": - version: 0.15.15 - resolution: "esbuild@npm:0.15.15" - dependencies: - "@esbuild/android-arm": 0.15.15 - "@esbuild/linux-loong64": 0.15.15 - esbuild-android-64: 0.15.15 - esbuild-android-arm64: 0.15.15 - esbuild-darwin-64: 0.15.15 - esbuild-darwin-arm64: 0.15.15 - esbuild-freebsd-64: 0.15.15 - esbuild-freebsd-arm64: 0.15.15 - esbuild-linux-32: 0.15.15 - esbuild-linux-64: 0.15.15 - esbuild-linux-arm: 0.15.15 - esbuild-linux-arm64: 0.15.15 - esbuild-linux-mips64le: 0.15.15 - esbuild-linux-ppc64le: 0.15.15 - esbuild-linux-riscv64: 0.15.15 - esbuild-linux-s390x: 0.15.15 - esbuild-netbsd-64: 0.15.15 - esbuild-openbsd-64: 0.15.15 - esbuild-sunos-64: 0.15.15 - esbuild-windows-32: 0.15.15 - esbuild-windows-64: 0.15.15 - esbuild-windows-arm64: 0.15.15 +"esbuild@npm:^0.17.0": + version: 0.17.0 + resolution: "esbuild@npm:0.17.0" + dependencies: + "@esbuild/android-arm": 0.17.0 + "@esbuild/android-arm64": 0.17.0 + "@esbuild/android-x64": 0.17.0 + "@esbuild/darwin-arm64": 0.17.0 + "@esbuild/darwin-x64": 0.17.0 + "@esbuild/freebsd-arm64": 0.17.0 + "@esbuild/freebsd-x64": 0.17.0 + "@esbuild/linux-arm": 0.17.0 + "@esbuild/linux-arm64": 0.17.0 + "@esbuild/linux-ia32": 0.17.0 + "@esbuild/linux-loong64": 0.17.0 + "@esbuild/linux-mips64el": 0.17.0 + "@esbuild/linux-ppc64": 0.17.0 + "@esbuild/linux-riscv64": 0.17.0 + "@esbuild/linux-s390x": 0.17.0 + "@esbuild/linux-x64": 0.17.0 + "@esbuild/netbsd-x64": 0.17.0 + "@esbuild/openbsd-x64": 0.17.0 + "@esbuild/sunos-x64": 0.17.0 + "@esbuild/win32-arm64": 0.17.0 + "@esbuild/win32-ia32": 0.17.0 + "@esbuild/win32-x64": 0.17.0 dependenciesMeta: "@esbuild/android-arm": optional: true - "@esbuild/linux-loong64": + "@esbuild/android-arm64": optional: true - esbuild-android-64: + "@esbuild/android-x64": optional: true - esbuild-android-arm64: + "@esbuild/darwin-arm64": optional: true - esbuild-darwin-64: + "@esbuild/darwin-x64": optional: true - esbuild-darwin-arm64: + "@esbuild/freebsd-arm64": optional: true - esbuild-freebsd-64: + "@esbuild/freebsd-x64": optional: true - esbuild-freebsd-arm64: + "@esbuild/linux-arm": optional: true - esbuild-linux-32: + "@esbuild/linux-arm64": optional: true - esbuild-linux-64: + "@esbuild/linux-ia32": optional: true - esbuild-linux-arm: + "@esbuild/linux-loong64": optional: true - esbuild-linux-arm64: + "@esbuild/linux-mips64el": optional: true - esbuild-linux-mips64le: + "@esbuild/linux-ppc64": optional: true - esbuild-linux-ppc64le: + "@esbuild/linux-riscv64": optional: true - esbuild-linux-riscv64: + "@esbuild/linux-s390x": optional: true - esbuild-linux-s390x: + "@esbuild/linux-x64": optional: true - esbuild-netbsd-64: + "@esbuild/netbsd-x64": optional: true - esbuild-openbsd-64: + "@esbuild/openbsd-x64": optional: true - esbuild-sunos-64: + "@esbuild/sunos-x64": optional: true - esbuild-windows-32: + "@esbuild/win32-arm64": optional: true - esbuild-windows-64: + "@esbuild/win32-ia32": optional: true - esbuild-windows-arm64: + "@esbuild/win32-x64": optional: true bin: esbuild: bin/esbuild - checksum: 9a194a310ac7d6989d1fe7354901d531d3b0d4cc1897a85a7cb9f1ae0fe8d82eb59747e63c91f676bab7bed8d6a1f28f620d49f043e7bd6203f9afe34031f739 + checksum: eabf1d3d9230b1367edbdd24c89a35f60861c120377844af9f8daa084133f4dfc43697484b14e92a209d2055c8903fdf2b43fee8dbabd7d1fbcd7031639fca9e languageName: node linkType: hard @@ -1377,12 +1420,12 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.28.0": - version: 8.28.0 - resolution: "eslint@npm:8.28.0" +"eslint@npm:^8.31.0": + version: 8.31.0 + resolution: "eslint@npm:8.31.0" dependencies: - "@eslint/eslintrc": ^1.3.3 - "@humanwhocodes/config-array": ^0.11.6 + "@eslint/eslintrc": ^1.4.1 + "@humanwhocodes/config-array": ^0.11.8 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 ajv: ^6.10.0 @@ -1401,7 +1444,7 @@ __metadata: file-entry-cache: ^6.0.1 find-up: ^5.0.0 glob-parent: ^6.0.2 - globals: ^13.15.0 + globals: ^13.19.0 grapheme-splitter: ^1.0.4 ignore: ^5.2.0 import-fresh: ^3.0.0 @@ -1422,7 +1465,7 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: 1b793486b2ec80f0602d75fff7116f7c39a3286f523608a999eead9bec4154a06841785d2b4fb87f8292a94cf85778c1dbfaec727772a09c4d604fdb9ff0809a + checksum: 5e5688bb864edc6b12d165849994812eefa67fb3fc44bb26f53659b63edcd8bcc68389d27cc6cc9e5b79ee22f24b6f311fa3ed047bddcafdec7d84c1b5561e4f languageName: node linkType: hard @@ -1690,13 +1733,6 @@ __metadata: languageName: node linkType: hard -"functional-red-black-tree@npm:^1.0.1": - version: 1.0.1 - resolution: "functional-red-black-tree@npm:1.0.1" - checksum: ca6c170f37640e2d94297da8bb4bf27a1d12bea3e00e6a3e007fd7aa32e37e000f5772acf941b4e4f3cf1c95c3752033d0c509af157ad8f526e7f00723b9eb9f - languageName: node - linkType: hard - "gauge@npm:^4.0.3": version: 4.0.4 resolution: "gauge@npm:4.0.4" @@ -1797,12 +1833,12 @@ __metadata: languageName: node linkType: hard -"globals@npm:^13.15.0": - version: 13.15.0 - resolution: "globals@npm:13.15.0" +"globals@npm:^13.19.0": + version: 13.19.0 + resolution: "globals@npm:13.19.0" dependencies: type-fest: ^0.20.2 - checksum: 383ade0873b2ab29ce6d143466c203ed960491575bc97406395e5c8434026fb02472ab2dfff5bc16689b8460269b18fda1047975295cd0183904385c51258bae + checksum: a000dbd00bcf28f0941d8a29c3522b1c3b8e4bfe4e60e262c477a550c3cbbe8dbe2925a6905f037acd40f9a93c039242e1f7079c76b0fd184bc41dcc3b5c8e2e languageName: node linkType: hard @@ -2199,19 +2235,19 @@ __metadata: "@types/mocha": ^9.1.1 "@types/node": 14.x "@types/vscode": ^1.68.0 - "@typescript-eslint/eslint-plugin": ^5.12.1 - "@typescript-eslint/parser": ^5.12.1 - "@vscode/test-electron": ^2.1.2 + "@typescript-eslint/eslint-plugin": ^5.48.1 + "@typescript-eslint/parser": ^5.48.1 + "@vscode/test-electron": ^2.2.2 + "@vscode/vsce": ^2.16.0 command-exists: ^1.2.9 - esbuild: ^0.15.15 - eslint: ^8.28.0 + esbuild: ^0.17.0 + eslint: ^8.31.0 fs-extra: ^10.1.0 glob: ^8.0.3 mocha: ^9.2.2 node-fetch: ^3.3.0 - ovsx: ^0.5.2 - typescript: ^4.9.3 - vsce: ^2.14.0 + ovsx: ^0.8.0 + typescript: ^4.9.4 languageName: unknown linkType: soft @@ -2572,6 +2608,13 @@ __metadata: languageName: node linkType: hard +"natural-compare-lite@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare-lite@npm:1.4.0" + checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -2711,19 +2754,19 @@ __metadata: languageName: node linkType: hard -"ovsx@npm:^0.5.2": - version: 0.5.2 - resolution: "ovsx@npm:0.5.2" +"ovsx@npm:^0.8.0": + version: 0.8.0 + resolution: "ovsx@npm:0.8.0" dependencies: + "@vscode/vsce": ^2.15.0 commander: ^6.1.0 follow-redirects: ^1.14.6 is-ci: ^2.0.0 leven: ^3.1.0 tmp: ^0.2.1 - vsce: ^2.6.3 bin: ovsx: lib/ovsx - checksum: 219bca5ff4795f03c4e78c451108a84701cd6d6dbcf6171acf2a36766e6ce745b011adc1f55db3ca0b5b28c7c4128decbc85f38f6a6fb599c5fc3e2d1f712212 + checksum: 17bde873cfb339411620af7d0d0eb822575ff0e71c4a70dd6095a53b0260fc47a479591ab704e58cab6d446bc4a1491ad60f052a6cc07a79c0f38aa9edc370b5 languageName: node linkType: hard @@ -3437,23 +3480,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^4.9.3": - version: 4.9.3 - resolution: "typescript@npm:4.9.3" +"typescript@npm:^4.9.4": + version: 4.9.4 + resolution: "typescript@npm:4.9.4" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 17b8f816050b412403e38d48eef0e893deb6be522d6dc7caf105e54a72e34daf6835c447735fd2b28b66784e72bfbf87f627abb4818a8e43d1fa8106396128dc + checksum: e782fb9e0031cb258a80000f6c13530288c6d63f1177ed43f770533fdc15740d271554cdae86701c1dd2c83b082cea808b07e97fd68b38a172a83dbf9e0d0ef9 languageName: node linkType: hard -"typescript@patch:typescript@^4.9.3#~builtin": - version: 4.9.3 - resolution: "typescript@patch:typescript@npm%3A4.9.3#~builtin::version=4.9.3&hash=f456af" +"typescript@patch:typescript@^4.9.4#~builtin": + version: 4.9.4 + resolution: "typescript@patch:typescript@npm%3A4.9.4#~builtin::version=4.9.4&hash=f456af" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: ef65c22622d864497d0a0c5db693523329b3284c15fe632e93ad9aa059e8dc38ef3bd767d6f26b1e5ecf9446f49bd0f6c4e5714a2eeaf352805dc002479843d1 + checksum: 37f6e2c3c5e2aa5934b85b0fddbf32eeac8b1bacf3a5b51d01946936d03f5377fe86255d4e5a4ae628fd0cd553386355ad362c57f13b4635064400f3e8e05b9d languageName: node linkType: hard @@ -3537,66 +3580,6 @@ __metadata: languageName: node linkType: hard -"vsce@npm:^2.14.0": - version: 2.14.0 - resolution: "vsce@npm:2.14.0" - dependencies: - azure-devops-node-api: ^11.0.1 - chalk: ^2.4.2 - cheerio: ^1.0.0-rc.9 - commander: ^6.1.0 - glob: ^7.0.6 - hosted-git-info: ^4.0.2 - keytar: ^7.7.0 - leven: ^3.1.0 - markdown-it: ^12.3.2 - mime: ^1.3.4 - minimatch: ^3.0.3 - parse-semver: ^1.1.1 - read: ^1.0.7 - semver: ^5.1.0 - tmp: ^0.2.1 - typed-rest-client: ^1.8.4 - url-join: ^4.0.1 - xml2js: ^0.4.23 - yauzl: ^2.3.1 - yazl: ^2.2.2 - bin: - vsce: vsce - checksum: 1d74c17b0fc2e1c0e5b0f6746db48c4b7111c3bde1c6e85e23511766ee428c4763b1d0ec74af7d1acfa9041dabc798b208546f95f79dd1d8eb00903a23f7a7c7 - languageName: node - linkType: hard - -"vsce@npm:^2.6.3": - version: 2.11.0 - resolution: "vsce@npm:2.11.0" - dependencies: - azure-devops-node-api: ^11.0.1 - chalk: ^2.4.2 - cheerio: ^1.0.0-rc.9 - commander: ^6.1.0 - glob: ^7.0.6 - hosted-git-info: ^4.0.2 - keytar: ^7.7.0 - leven: ^3.1.0 - markdown-it: ^12.3.2 - mime: ^1.3.4 - minimatch: ^3.0.3 - parse-semver: ^1.1.1 - read: ^1.0.7 - semver: ^5.1.0 - tmp: ^0.2.1 - typed-rest-client: ^1.8.4 - url-join: ^4.0.1 - xml2js: ^0.4.23 - yauzl: ^2.3.1 - yazl: ^2.2.2 - bin: - vsce: vsce - checksum: 334a3d74a70cf8259dae2c03b47c109697bf4165646dbd587dca4fd803e3baa97a330888f5686fdf97e2f55224e7de8c3eb55a7031aba5aceabd178dc9061a9f - languageName: node - linkType: hard - "web-streams-polyfill@npm:^3.0.3": version: 3.2.1 resolution: "web-streams-polyfill@npm:3.2.1" From 43ead7adadab76c4e3ac8ce1a02872ad23290514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 14 Jan 2023 21:17:01 +0100 Subject: [PATCH 5/6] wip tests --- {test => src/test}/runTest.ts | 5 ++- src/test/suite/extension.test.ts | 17 +++++++++++ {test => src/test}/suite/index.ts | 0 test/suite/extension.test.ts | 51 ------------------------------- 4 files changed, 19 insertions(+), 54 deletions(-) rename {test => src/test}/runTest.ts (91%) create mode 100644 src/test/suite/extension.test.ts rename {test => src/test}/suite/index.ts (100%) delete mode 100644 test/suite/extension.test.ts diff --git a/test/runTest.ts b/src/test/runTest.ts similarity index 91% rename from test/runTest.ts rename to src/test/runTest.ts index fb4650c..6f63537 100644 --- a/test/runTest.ts +++ b/src/test/runTest.ts @@ -1,5 +1,4 @@ import * as path from 'path'; - import { runTests } from '@vscode/test-electron'; async function main() { @@ -26,13 +25,13 @@ async function main() { * * See `code --help` for possible arguments. */ - launchArgs: [path.resolve(__dirname, '../../playground'), '--disable-extensions'] + launchArgs: [path.resolve(__dirname, '../../playground/laravel')] }); } catch (err) { console.error('Failed to run tests'); - process.exit(1); + // process.exit(1); } } diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts new file mode 100644 index 0000000..26aa085 --- /dev/null +++ b/src/test/suite/extension.test.ts @@ -0,0 +1,17 @@ +import * as assert from 'assert'; +import * as vscode from 'vscode'; + +suite('Extension Test Suite', () => { + test('Open messy file and save', async () => { + const foundFiles = await vscode.workspace.findFiles("config/vendor.php") + const document = await vscode.workspace.openTextDocument(foundFiles[0]) + + const oldText = document.getText(); + + await document.save(); + + const newText = document.getText(); + + assert.notStrictEqual(oldText, newText); + }); +}); \ No newline at end of file diff --git a/test/suite/index.ts b/src/test/suite/index.ts similarity index 100% rename from test/suite/index.ts rename to src/test/suite/index.ts diff --git a/test/suite/extension.test.ts b/test/suite/extension.test.ts deleted file mode 100644 index 2b80ec8..0000000 --- a/test/suite/extension.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as assert from 'assert'; - -// You can import and use all API from the 'vscode' module -// as well as import your extension to test it -import * as fs from 'fs'; -import { beforeEach } from 'mocha'; -import path = require('path'); -import * as vscode from 'vscode'; -import * as myExtension from '../../extension'; -import { PresetOptions } from '../../types'; -import { asAbsolutePathFromWorkspaceFolder, buildCommandFromConfig } from '../../util'; - -suite('Extension Test Suite', () => { - vscode.window.showInformationMessage('Start all tests.'); - - // TODO: Not there yet... - // myExtension.activate(); - - beforeEach(() => { - const workspaceConfigFile = path.resolve(__dirname, '../../../plaground/.vscode/settings.json'); - - if (fs.existsSync(workspaceConfigFile)) { - fs.rmSync(workspaceConfigFile); - } - }); - - test('Default config settings', () => { - const config = vscode.workspace.getConfiguration('laravel-pint'); - - assert.strictEqual(config.get('configPath'), ''); - assert.strictEqual(config.get('executablePath'), ''); - assert.strictEqual(config.get('formatOnSave'), true); - assert.strictEqual(config.get('preset'), 'auto'); - assert.strictEqual(config.get('runInLaravelSail'), false); - assert.strictEqual(config.get('sailExecutablePath'), ''); - }); - - test('Build command with config args', async () => { - const config = vscode.workspace.getConfiguration('laravel-pint'); - - await config.update('executablePath', 'pint'); - await config.update('configPath', 'mypintconfig.json'); - - const cmd = await buildCommandFromConfig('index.php', config); - - console.log(cmd); - - assert.ok(cmd); - assert.ok(cmd.filter(value => ['vendor/bin/pint', 'index.php', '--config', 'mypintconfig.json'].includes(value)).length > 1); - }); -}); \ No newline at end of file From 8585501784da56301adb2673c45dece81b774205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Sat, 21 Jan 2023 01:34:15 +0100 Subject: [PATCH 6/6] make tests work --- .vscode/launch.json | 8 +++-- package.json | 2 ++ playground | 2 +- src/commands.ts | 4 +-- src/extension.ts | 2 +- src/test/runTest.ts | 58 ++++++++++++++++++++++---------- src/test/suite/extension.test.ts | 47 ++++++++++++++++++++++---- yarn.lock | 9 +++++ 8 files changed, 102 insertions(+), 30 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6b55db2..5d290d6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,12 +21,16 @@ "type": "extensionHost", "request": "launch", "args": [ + "--skip-welcome", + "--disable-extensions", + "--skip-release-notes", "--extensionDevelopmentPath=${workspaceFolder}", - "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" + "--extensionTestsPath=${workspaceFolder}/out/test/suite/index", + "${workspaceFolder}/playground/laravel" ], "outFiles": [ "${workspaceFolder}/out/test/**/*.js" ] } ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 6e5e79b..a7d5131 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,7 @@ "@types/glob": "^8.0.0", "@types/mocha": "^9.1.1", "@types/node": "14.x", + "@types/tmp": "^0.2.3", "@types/vscode": "^1.68.0", "@typescript-eslint/eslint-plugin": "^5.48.1", "@typescript-eslint/parser": "^5.48.1", @@ -150,6 +151,7 @@ "mocha": "^9.2.2", "node-fetch": "^3.3.0", "ovsx": "^0.8.0", + "tmp": "^0.2.1", "typescript": "^4.9.4" }, "engines": { diff --git a/playground b/playground index 5f212c9..ae84e2f 160000 --- a/playground +++ b/playground @@ -1 +1 @@ -Subproject commit 5f212c978db0273bb29de7a3975fdf8bacde596e +Subproject commit ae84e2f48380d39ffc18179e8779533933c964b4 diff --git a/src/commands.ts b/src/commands.ts index 1967dd7..dfd243a 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,12 +1,12 @@ import { window } from "vscode"; import PintEditService from "./PintEditService"; -export function formatCommand(pintEditService: PintEditService) { +export async function formatCommand(pintEditService: PintEditService) { const activeTextEditorDocumentUri = window.activeTextEditor?.document.uri; if (!activeTextEditorDocumentUri) { return; } - pintEditService.formatFile(activeTextEditorDocumentUri); + return await pintEditService.formatFile(activeTextEditorDocumentUri); } diff --git a/src/extension.ts b/src/extension.ts index 085d4f4..f4b9c90 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -46,7 +46,7 @@ export async function activate(context: ExtensionContext) { } ); - const formatFileCommand = commands.registerCommand('laravel-pint.format', () => formatCommand(editService)); + const formatFileCommand = commands.registerCommand('laravel-pint.format', async () => await formatCommand(editService)); const formatProjectCommand = commands.registerCommand('laravel-pint.formatProject', () => editService.formatWorkspace()); context.subscriptions.push( diff --git a/src/test/runTest.ts b/src/test/runTest.ts index 6f63537..7e27b5e 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -1,37 +1,61 @@ import * as path from 'path'; import { runTests } from '@vscode/test-electron'; +import * as tmp from 'tmp'; +import * as fs from 'fs-extra'; + +async function createTempDir() { + return new Promise((resolve, reject) => { + tmp.dir((err, dir) => { + if (err) { + return reject(err); + } + resolve(dir); + }); + }); +} + +async function createSettings(): Promise { + const userDataDirectory = await createTempDir(); + process.env.VSC_JUPYTER_VSCODE_SETTINGS_DIR = userDataDirectory; + const settingsFile = path.join(userDataDirectory, "User", "settings.json"); + const defaultSettings: Record = { + "laravel-pint.enable": true, + "editor.defaultFormatter": "open-southeners.laravel-pint", + "laravel-pint.enableDebugLogs": true, + "security.workspace.trust.enabled": false, // Disable trusted workspaces. + }; + + fs.ensureDirSync(path.dirname(settingsFile)); + fs.writeFileSync(settingsFile, JSON.stringify(defaultSettings, undefined, 4)); + return userDataDirectory; +} async function main() { try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` const extensionDevelopmentPath = path.resolve(__dirname, '../../'); - // The path to test runner - // Passed to --extensionTestsPath const extensionTestsPath = path.resolve(__dirname, './suite/index'); - // Download VS Code, unzip it and run the integration test + const workspacePath = path.resolve(__dirname, '../../playground/laravel'); + + const userDataDirectory = await createSettings(); + await runTests({ extensionDevelopmentPath, extensionTestsPath, - /** - * A list of launch arguments passed to VS Code executable, in addition to `--extensionDevelopmentPath` - * and `--extensionTestsPath` which are provided by `extensionDevelopmentPath` and `extensionTestsPath` - * options. - * - * If the first argument is a path to a file/folder/workspace, the launched VS Code instance - * will open it. - * - * See `code --help` for possible arguments. - */ - launchArgs: [path.resolve(__dirname, '../../playground/laravel')] + launchArgs: [workspacePath] + .concat(["--wait"]) + .concat(["--skip-welcome"]) + .concat(["--disable-extensions"]) + .concat(["--skip-release-notes"]) + .concat(["--enable-proposed-api"]) + .concat(["--user-data-dir", userDataDirectory]), }); } catch (err) { console.error('Failed to run tests'); - // process.exit(1); + process.exit(1); } } diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index 26aa085..eb8dc43 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -1,17 +1,50 @@ import * as assert from 'assert'; +import { afterEach } from 'mocha'; +import * as fs from 'fs'; import * as vscode from 'vscode'; +const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +let originalFile = { + path: '', + content: '' +}; + +afterEach(async () => { + if (originalFile.path !== '') { + fs.writeFileSync(originalFile.path, originalFile.content, { encoding: 'utf-8' }); + } +}); + suite('Extension Test Suite', () => { - test('Open messy file and save', async () => { - const foundFiles = await vscode.workspace.findFiles("config/vendor.php") - const document = await vscode.workspace.openTextDocument(foundFiles[0]) + test('Open messy file and run formatting over it', async () => { + await vscode.extensions.getExtension('open-southeners.laravel-pint')!.activate(); + + const foundFiles = await vscode.workspace.findFiles("config/vendor.php"); + const document = await vscode.workspace.openTextDocument(foundFiles[0]); + await vscode.languages.setTextDocumentLanguage(document, "php"); + try { + await vscode.window.showTextDocument(document); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + throw error; + } + const oldText = document.getText(); + + originalFile.path = document.uri.path; + originalFile.content = oldText; - await document.save(); + console.time('formatting file with Pint'); + + await vscode.commands.executeCommand("laravel-pint.format"); - const newText = document.getText(); + console.timeEnd('formatting file with Pint'); - assert.notStrictEqual(oldText, newText); - }); + await wait(1000); + + assert.notStrictEqual(oldText, document.getText()); + }).timeout(5000); }); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 26ea668..8ba0728 100644 --- a/yarn.lock +++ b/yarn.lock @@ -337,6 +337,13 @@ __metadata: languageName: node linkType: hard +"@types/tmp@npm:^0.2.3": + version: 0.2.3 + resolution: "@types/tmp@npm:0.2.3" + checksum: 0ca45e99b3b3c6959d5c4f4555f73c8007db540cfb0fbbb9373217f9ab85e67eef75193f51a1d6564b0ee6c6f5ffa259d1034d7f7530a5b7ce80acb94cfc4daa + languageName: node + linkType: hard + "@types/vscode@npm:^1.68.0": version: 1.73.1 resolution: "@types/vscode@npm:1.73.1" @@ -2234,6 +2241,7 @@ __metadata: "@types/glob": ^8.0.0 "@types/mocha": ^9.1.1 "@types/node": 14.x + "@types/tmp": ^0.2.3 "@types/vscode": ^1.68.0 "@typescript-eslint/eslint-plugin": ^5.48.1 "@typescript-eslint/parser": ^5.48.1 @@ -2247,6 +2255,7 @@ __metadata: mocha: ^9.2.2 node-fetch: ^3.3.0 ovsx: ^0.8.0 + tmp: ^0.2.1 typescript: ^4.9.4 languageName: unknown linkType: soft