Adding launch configuration for debugging tests (separate from server)

This commit is contained in:
Kirill Dubovitskiy 2023-08-07 16:18:09 -07:00
parent c12be8daf6
commit bf41d986c9
3 changed files with 62 additions and 5 deletions

22
.vscode/launch.json vendored
View file

@ -34,6 +34,7 @@
"request": "launch",
"cwd": "${workspaceFolder}/extension",
"args": [
// Pass a directory to manually test in
"${workspaceFolder}/extension/manual-testing-sandbox",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
],
@ -45,5 +46,26 @@
"CONTINUE_SERVER_URL": "http://localhost:8001"
}
},
{
"name": "Tests (VSCode)",
"type": "extensionHost",
"request": "launch",
"cwd": "${workspaceFolder}/extension",
"runtimeExecutable": "${execPath}",
"args": [
// Pass a directory to run tests in
"${workspaceFolder}/extension/manual-testing-sandbox",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
"--extensionTestsPath=${workspaceFolder}/extension/out/test-runner/mochaRunner"
],
"outFiles": [
// Allows setting breakpoints in test suites across the /src folder
"${workspaceFolder}/extension/out/test-suites/**/*.js",
// Allows setting breakpoints in mocha test runner file
"${workspaceFolder}/extension/out/test-runner/**/*.js"
],
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "vscode-extension:tests:build",
}
]
}

41
.vscode/tasks.json vendored
View file

@ -1,6 +1,7 @@
{
"version": "2.0.0",
"tasks": [
// Compile and bundle the extension
{
"label": "vscode-extension:build",
"dependsOn": [
@ -38,10 +39,9 @@
// This will be useful for preventing debugging if there are compile errors
{
"label": "vscode-extension:tsc",
"type": "shell",
"command": "echo lol",
// "script": "tsc",
// "path": "extension",
"type": "npm",
"script": "tsc",
"path": "extension",
"problemMatcher": [
"$tsc"
],
@ -50,6 +50,39 @@
"clear": true,
},
},
//
// 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
"vscode-extension:tsc",
"vscode-extension:tests:esbuild"
],
},
{
"label": "vscode-extension:tests:esbuild",
"type": "npm",
"script": "build-test",
"path": "extension",
"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

@ -9,8 +9,10 @@ describe("Can start python server", () => {
test("Can start python server", async () => {
await startContinuePythonServer();
await new Promise((resolve) => setTimeout(resolve, 50));
await new Promise((resolve) => setTimeout(resolve, 500));
// Currently is flaky, keeping because still feels useful and we can fix in a followup commit
//
// Check if server is running
const serverUrl = getContinueServerUrl();
const response = await fetch(`${serverUrl}/health`);