rip out mocha

This commit is contained in:
Dallin Romney 2025-06-17 13:48:37 -07:00
parent f3653d8614
commit a852e63851
10 changed files with 42 additions and 623 deletions

26
.vscode/launch.json vendored
View file

@ -73,32 +73,6 @@
"sourceMaps": true
// "preLaunchTask": "gui:dev"
},
// Has to be run after starting the server (separately or using the compound configuration)
{
"name": "Run tests",
"type": "extensionHost",
"request": "launch",
"cwd": "${workspaceFolder}/extensions/vscode",
"runtimeExecutable": "${execPath}",
"args": [
// Pass a directory to run tests in
"${workspaceFolder}/extensions/vscode/manual-testing-sandbox",
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
"--extensionTestsPath=${workspaceFolder}/extensions/vscode/out/test/runner/mochaRunner"
],
"outFiles": [
// Allows setting breakpoints in test suites across the /src folder
"${workspaceFolder}/extensions/vscode/out/test/test-suites/**/*.js",
// Allows setting breakpoints in mocha test runner file
"${workspaceFolder}/extensions/vscode/out/test/runner/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "vscode-extension:tests:build",
"env": {
// Avoid timing out when stopping on breakpoints during debugging in VSCode
"MOCHA_TIMEOUT": "0"
}
},
{
"name": "[Core] Jest Test Debugger, Current Open File",
"type": "node",

33
.vscode/tasks.json vendored
View file

@ -106,39 +106,6 @@
"cwd": "${workspaceFolder}/extensions/vscode"
}
},
//
// Compile and bundle tests
{
"label": "vscode-extension:tests:build",
"dependsOn": [
// Build the extension
"vscode-extension:build",
// To detect compile errors - this type checks both the extension and the tests
"tsc:watch",
"vscode-extension:tests:esbuild"
]
},
{
"label": "vscode-extension:tests:esbuild",
"type": "npm",
"script": "build-test",
"path": "extensions/vscode",
"problemMatcher": [
{
"pattern": [
{
"regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
},
//
// Install or update all dependencies for all projects in the monrepo
{
"label": "install-all-dependencies",

View file

@ -18,7 +18,6 @@ node_modules/**
manual-testing-sandbox
esbuild.js
esbuild.test.mjs
importMetaUrl.js
scripts
e2e

View file

@ -1,67 +0,0 @@
import * as esbuild from "esbuild";
import glob from "glob";
/**
* Bundles tests into multiple files, runTestOnVSCodeHost is then run using node runTestOnVSCodeHost.js
* It downloads vscode, starts it and passes test file to run - mochaRunner.js
* mochaRunner.js then runs tests using Mocha class
*/
console.log("Bundling tests...");
// Bundles script to run tests on VSCode host + mocha runner that will be invoked from within VSCode host
await esbuild.build({
entryPoints: [
// Runs mocha runner on VSCode host using runTests from @vscode/test-electron
"src/test/runner/runTestOnVSCodeHost.ts",
// Runs the bundled tests using Mocha class
"src/test/runner/mochaRunner.ts",
],
bundle: true,
outdir: "out",
external: [
"vscode",
// Its important to externalize mocha, otherwise mocha seems to be not initialized properly when running tests
// Example warning by esbuild when mocha is not externalized:
// [WARNING] "./reporters/parallel-buffered" should be marked as external for use with "require.resolve" [require-resolve-not-external]
"mocha",
],
format: "cjs",
platform: "node",
sourcemap: true,
loader: {
// eslint-disable-next-line @typescript-eslint/naming-convention
".node": "file",
},
});
/**
* Note: Bundling is done to work around import issues, for example with fkill that does not provide cjs module.
* Rather than figuring out a combination of tsconfig.json that would work, I decided to bundle tests instead.
*/
await esbuild.build({
// Tests can be added anywhere in src folder
entryPoints: glob.sync("src/**/*.test.ts"),
bundle: true,
outdir: "out",
external: [
"vscode",
// Its important to externalize mocha, otherwise mocha seems to be not initialized properly when running tests
"mocha",
],
format: "cjs",
platform: "node",
sourcemap: true,
loader: {
// eslint-disable-next-line @typescript-eslint/naming-convention
".node": "file",
},
// To allow import.meta.path for transformers.js
// https://github.com/evanw/esbuild/issues/1492#issuecomment-893144483
inject: ["./scripts/importMetaUrl.js"],
define: { "import.meta.url": "importMetaUrl" },
});

View file

@ -16,7 +16,6 @@
"@types/node-fetch": "^2.6.11",
"@types/uuid": "^9.0.8",
"@vscode/ripgrep": "^1.15.9",
"@vscode/test-electron": "^2.3.9",
"axios": "^1.2.5",
"core": "file:../../core",
"cors": "^2.8.5",
@ -70,8 +69,6 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/follow-redirects": "^1.14.4",
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.6",
"@types/node": "16.x",
"@types/react-dom": "^18.2.4",
"@types/request": "^2.48.8",
@ -84,9 +81,7 @@
"esbuild": "0.17.19",
"esbuild-visualizer": "^0.6.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"json-schema-to-typescript": "^12.0.0",
"mocha": "^10.4.0",
"ovsx": "^0.8.3",
"rimraf": "^5.0.5",
"typescript": "^5.6.3",
@ -2448,16 +2443,6 @@
"@types/node": "*"
}
},
"node_modules/@types/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==",
"dev": true,
"dependencies": {
"@types/minimatch": "^5.1.2",
"@types/node": "*"
}
},
"node_modules/@types/hast": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/@types/hast/-/hast-2.3.10.tgz",
@ -2541,12 +2526,6 @@
"integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==",
"dev": true
},
"node_modules/@types/mocha": {
"version": "10.0.9",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.9.tgz",
"integrity": "sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q==",
"dev": true
},
"node_modules/@types/ms": {
"version": "0.7.34",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
@ -3088,136 +3067,6 @@
"yauzl": "^2.9.2"
}
},
"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==",
"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/test-electron/node_modules/chalk": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
"integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
"engines": {
"node": "^12.17.0 || ^14.13 || >=16.0.0"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/@vscode/test-electron/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==",
"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/@vscode/test-electron/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==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/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==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/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==",
"dependencies": {
"chalk": "^5.0.0",
"is-unicode-supported": "^1.1.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/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==",
"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/@vscode/test-electron/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==",
"dependencies": {
"onetime": "^5.1.0",
"signal-exit": "^3.0.2"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@vscode/test-electron/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==",
"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/@vscode/vsce": {
"version": "2.32.0",
"resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.32.0.tgz",
@ -3599,6 +3448,7 @@
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz",
"integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==",
"dev": true,
"peer": true,
"engines": {
"node": ">=6"
}
@ -4039,7 +3889,8 @@
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
"dev": true,
"peer": true
},
"node_modules/buffer": {
"version": "5.7.1",
@ -4308,6 +4159,7 @@
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"peer": true,
"engines": {
"node": ">=10"
},
@ -5156,7 +5008,8 @@
"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=="
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true
},
"node_modules/cors": {
"version": "2.8.5",
@ -5330,6 +5183,7 @@
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
"integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=10"
},
@ -6666,6 +6520,7 @@
"resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
"integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
"dev": true,
"peer": true,
"bin": {
"flat": "cli.js"
}
@ -7279,6 +7134,7 @@
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true,
"peer": true,
"bin": {
"he": "bin/he"
}
@ -7550,7 +7406,8 @@
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
"dev": true
},
"node_modules/immer": {
"version": "9.0.21",
@ -7955,7 +7812,8 @@
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true
},
"node_modules/isexe": {
"version": "2.0.0",
@ -8301,6 +8159,7 @@
"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",
@ -8391,6 +8250,7 @@
"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"
}
@ -9440,6 +9300,7 @@
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz",
"integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-colors": "^4.1.3",
"browser-stdout": "^1.3.1",
@ -9475,6 +9336,7 @@
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
@ -9484,6 +9346,7 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0"
}
@ -9493,6 +9356,7 @@
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"peer": true,
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
@ -9504,6 +9368,7 @@
"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.3.1"
}
@ -9513,6 +9378,7 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"peer": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
@ -9525,6 +9391,7 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
@ -9537,6 +9404,7 @@
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@ -9552,6 +9420,7 @@
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@ -9569,6 +9438,7 @@
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
"dev": true,
"peer": true,
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
@ -10559,7 +10429,8 @@
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
"dev": true
},
"node_modules/parent-module": {
"version": "1.0.1",
@ -11159,7 +11030,8 @@
"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=="
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
"dev": true
},
"node_modules/promise-inflight": {
"version": "1.0.1",
@ -11364,6 +11236,7 @@
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true,
"peer": true,
"dependencies": {
"safe-buffer": "^5.1.0"
}
@ -11572,6 +11445,7 @@
"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",
@ -11585,7 +11459,8 @@
"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=="
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/readdirp": {
"version": "3.6.0",
@ -12125,6 +12000,7 @@
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true,
"peer": true,
"dependencies": {
"randombytes": "^2.1.0"
}
@ -12168,7 +12044,8 @@
"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=="
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"dev": true
},
"node_modules/setprototypeof": {
"version": "1.2.0",
@ -12499,66 +12376,6 @@
"integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==",
"license": "MIT"
},
"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==",
"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/stdin-discarder/node_modules/bl": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz",
"integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==",
"dependencies": {
"buffer": "^6.0.3",
"inherits": "^2.0.4",
"readable-stream": "^3.4.0"
}
},
"node_modules/stdin-discarder/node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"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/stdin-discarder/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==",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/stoppable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
@ -16688,7 +16505,8 @@
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz",
"integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==",
"dev": true
"dev": true,
"peer": true
},
"node_modules/wrap-ansi": {
"version": "6.2.0",
@ -16892,6 +16710,7 @@
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
"integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
"dev": true,
"peer": true,
"dependencies": {
"camelcase": "^6.0.0",
"decamelize": "^4.0.0",
@ -16907,6 +16726,7 @@
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}

View file

@ -622,10 +622,8 @@
"rebuild": "electron-rebuild -v 19.1.8 node-pty",
"lint": "eslint src --ext ts",
"lint:fix": "eslint . --ext ts --fix",
"build-test": "npm run esbuild && node esbuild.test.mjs",
"test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"test": "vitest run",
"vitest": "vitest run",
"quick-test": "npm run build-test && node ./out/runTestOnVSCodeHost.js",
"write-build-timestamp": "node scripts/write-build-timestamp.js",
"prepackage": "node scripts/prepackage.js",
"package": "node scripts/package.js",
@ -661,8 +659,6 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/follow-redirects": "^1.14.4",
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.6",
"@types/node": "16.x",
"@types/react-dom": "^18.2.4",
"@types/request": "^2.48.8",
@ -675,9 +671,7 @@
"esbuild": "0.17.19",
"esbuild-visualizer": "^0.6.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"json-schema-to-typescript": "^12.0.0",
"mocha": "^10.4.0",
"ovsx": "^0.8.3",
"rimraf": "^5.0.5",
"typescript": "^5.6.3",
@ -692,7 +686,6 @@
"@types/node-fetch": "^2.6.11",
"@types/uuid": "^9.0.8",
"@vscode/ripgrep": "^1.15.9",
"@vscode/test-electron": "^2.3.9",
"axios": "^1.2.5",
"core": "file:../../core",
"cors": "^2.8.5",

View file

@ -1,49 +0,0 @@
import * as path from "node:path";
import * as glob from "glob";
import Mocha from "mocha";
export function run() {
// Avoid timing out when stopping on breakpoints during debugging in VSCode
const timeoutOption = process.env.MOCHA_TIMEOUT
? Number.parseInt(process.env.MOCHA_TIMEOUT)
: // : undefined;
30_000;
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
color: true,
timeout: timeoutOption,
});
// See esbuild.test.mjs for more details
// Assumes this file is in out/test/runner/mochaRunner.js
const compiledTestSuitesDirectory = path.resolve(__dirname);
glob
.sync("**/**.test.js", { cwd: compiledTestSuitesDirectory })
.forEach((file) => {
mocha.addFile(path.resolve(compiledTestSuitesDirectory, file));
});
console.log(
`Testing files in ${compiledTestSuitesDirectory}: ${mocha.files}`,
);
return new Promise<void>((resolve, reject) => {
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
}

View file

@ -1,127 +0,0 @@
import fs from "node:fs";
import * as path from "node:path";
import { runTests } from "@vscode/test-electron";
import { defaultConfig } from "core/config/default";
export const testWorkspacePath = path.resolve(
__dirname,
"..",
"src",
"test",
"fixtures",
"test-workspace",
);
const continueGlobalDir = path.resolve(
__dirname,
"..",
"src",
"test",
"fixtures",
".continue",
);
function setupTestWorkspace() {
if (fs.existsSync(testWorkspacePath)) {
fs.rmSync(testWorkspacePath, { recursive: true });
}
fs.mkdirSync(testWorkspacePath, {
recursive: true,
});
fs.writeFileSync(
path.join(testWorkspacePath, "test.py"),
"print('Hello World!')",
);
fs.writeFileSync(
path.join(testWorkspacePath, "index.js"),
"console.log('Hello World!')",
);
fs.writeFileSync(
path.join(testWorkspacePath, "test.py"),
"print('Hello World!')",
);
fs.mkdirSync(path.join(testWorkspacePath, "test-folder"));
fs.writeFileSync(
path.join(testWorkspacePath, "test-folder", "test.js"),
"console.log('Hello World!')",
);
}
function setupContinueGlobalDir() {
if (fs.existsSync(continueGlobalDir)) {
fs.rmSync(continueGlobalDir, { recursive: true });
}
fs.mkdirSync(continueGlobalDir, {
recursive: true,
});
fs.writeFileSync(
path.join(continueGlobalDir, "config.json"),
JSON.stringify({
...defaultConfig,
models: [
{
title: "Test Model",
provider: "openai",
model: "gpt-3.5-turbo",
apiKey: "API_KEY",
},
],
}),
);
}
function cleanupTestWorkspace() {
if (fs.existsSync(testWorkspacePath)) {
fs.rmSync(testWorkspacePath, { recursive: true });
}
}
function cleanupContinueGlobalDir() {
if (fs.existsSync(continueGlobalDir)) {
fs.rmSync(continueGlobalDir, { recursive: true });
}
}
async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
// Assumes this file is in out/runTestOnVSCodeHost.js
const extensionDevelopmentPath = path.resolve(__dirname, "../");
console.log("extensionDevelopmentPath", extensionDevelopmentPath);
// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(
extensionDevelopmentPath,
"out/mochaRunner",
);
const extensionTestsEnv = {
NODE_ENV: "test",
CONTINUE_GLOBAL_DIR: continueGlobalDir,
};
setupTestWorkspace();
setupContinueGlobalDir();
// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
extensionTestsEnv,
launchArgs: [testWorkspacePath],
});
} catch (err) {
console.error("Failed to run tests", err);
process.exit(1);
} finally {
cleanupTestWorkspace();
cleanupContinueGlobalDir();
}
}
main();

View file

@ -1,89 +0,0 @@
import assert from "node:assert";
import path from "node:path";
import { describe, test } from "mocha";
import * as vscode from "vscode";
import { VsCodeIdeUtils } from "../../util/ideUtils";
import { testWorkspacePath } from "../runner/runTestOnVSCodeHost";
const util = require("node:util");
const asyncExec = util.promisify(require("node:child_process").exec);
/*
TODO check uri => path assumptions, will only work in some environments.
*/
describe("IDE Utils", () => {
const utils = new VsCodeIdeUtils();
const testPyPath = path.join(testWorkspacePath, "test.py");
const testJsPath = path.join(testWorkspacePath, "test-folder", "test.js");
test("getWorkspaceDirectories", async () => {
const [dir] = utils.getWorkspaceDirectories();
assert(dir.toString().endsWith("test-workspace"));
});
test("fileExists", async () => {
const exists2 = await utils.fileExists(
vscode.Uri.file(path.join(testWorkspacePath, "test.py")),
);
assert(exists2);
});
test("getOpenFiles", async () => {
let openFiles = utils.getOpenFiles();
assert(openFiles.length === 0);
// await utils.openFile(testPyPath);
let document = await vscode.workspace.openTextDocument(testPyPath);
await vscode.window.showTextDocument(document, {
preview: false,
});
openFiles = utils.getOpenFiles();
assert(openFiles.length === 1);
assert(openFiles[0].fsPath === testPyPath);
document = await vscode.workspace.openTextDocument(testJsPath);
await vscode.window.showTextDocument(document, {
preview: false,
});
openFiles = utils.getOpenFiles();
assert(openFiles.length === 2);
assert(openFiles.find((f) => f.fsPath === testPyPath));
assert(openFiles.find((f) => f.fsPath === testJsPath));
});
test("getUniqueId", async () => {
const uniqueId = utils.getUniqueId();
assert(uniqueId.length === 64);
const regex = /^[a-z0-9]+$/;
assert(regex.test(uniqueId));
});
test.skip("getTerminalContents", async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
const terminal = vscode.window.createTerminal();
await new Promise((resolve) => setTimeout(resolve, 1000));
terminal.show();
await new Promise((resolve) => setTimeout(resolve, 1000));
terminal.sendText("echo abcdefg", true);
const contents = await utils.getTerminalContents(1);
console.log("TERMINAL CONTENTS: ", contents);
assert(contents.includes("abcdefg"));
terminal.dispose();
});
test("noDiff", async () => {
const noDiff = await utils.getDiff(false);
assert(noDiff.length === 0);
});
test.skip("getBranch", async () => {
const uri = vscode.Uri.file(testWorkspacePath);
const branch = await utils.getBranch(uri);
assert(typeof branch === "string");
const { stdout } = await asyncExec("git rev-parse --abbrev-ref HEAD", {
cwd: __dirname,
});
assert(branch === stdout?.trim());
});
});

View file

@ -9,11 +9,9 @@
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"types": ["mocha"] // This solves conflict between jest and mocha: https://github.com/cypress-io/cypress/issues/7435#issuecomment-631695007
"skipLibCheck": true
},
"include": ["src/**/*", "../../core/**/*.ts", "../../core/**/*.d.ts"],
// core/test uses @types/jest, which conflicts with @types/mocha
"exclude": [
"../../core/dist/**/*",
"../../core/**/*.test.ts",