diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d382c7..1bcb43a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ name: Release on: pull_request: - types: [synchronize] push: branches: - main diff --git a/.vscode/launch.json b/.vscode/launch.json index bffbc27..96c227b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,7 +21,7 @@ "type": "extensionHost", "request": "launch", "args": [ - "${workspaceFolder}/sampleWorkspace", + "${workspaceFolder}/test/workspace1", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" ], diff --git a/src/extension.ts b/src/extension.ts index c2e5f51..d1c3fba 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,7 +30,6 @@ const startHttpServer = async ( host: string, port: number, fallbackPorts: number[], - showNotification: boolean = false ): Promise => { let isInUse = false; if (port) { @@ -39,7 +38,7 @@ const startHttpServer = async ( if (fallbackPorts.length > 0) { const nextPort = fallbackPorts.shift(); if (nextPort) { - startHttpServer(context, host, nextPort, fallbackPorts, true); + startHttpServer(context, host, nextPort, fallbackPorts); return; } else { isInUse = true; diff --git a/src/test/runTest.ts b/src/test/runTest.ts index d44f777..b6139ab 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -13,10 +13,10 @@ async function main() { const extensionTestsPath = path.resolve(__dirname, "./suite/index"); // Get the directory path to a sample workspace - const sampleWorkspace = path.resolve(__dirname, "../../sampleWorkspace"); + const workspace1 = path.resolve(__dirname, "./workspace1"); // VSCode launch arguments - const launchArgs = [sampleWorkspace]; + const launchArgs = [workspace1]; // Download VS Code, unzip it and run the integration test await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs }); } catch (err) { diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index 0c1df95..237cc40 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -19,10 +19,10 @@ suite("Extension Test Suite", () => { const workspaceFolders = (await makeRequest("custom.workspaceFolders")) as string[]; assert(workspaceFolders.length === 1); const ws = workspaceFolders[0] as any; - assert(ws.name === 'sampleWorkspace'); + assert(ws.name === 'workspace1'); assert(ws.index === 0); assert(ws.uri.startsWith("file://")); - assert(ws.uri.endsWith("/sampleWorkspace")); + assert(ws.uri.endsWith("/workspace1")); }); test("get all commands registred in vscode", async () => { diff --git a/sampleWorkspace/demo.py b/src/test/workspace1/demo.py similarity index 100% rename from sampleWorkspace/demo.py rename to src/test/workspace1/demo.py diff --git a/sampleWorkspace/samples.http b/src/test/workspace1/samples.http similarity index 60% rename from sampleWorkspace/samples.http rename to src/test/workspace1/samples.http index 5573573..1f68101 100644 --- a/sampleWorkspace/samples.http +++ b/src/test/workspace1/samples.http @@ -1,31 +1,45 @@ -### send a message to vscode -POST http://localhost:37100 HTTP/1.1 +@endpoint = http://localhost:43285 + +### show a warning message in vscode and get a choice selection +POST {{endpoint}} HTTP/1.1 content-type: application/json -{"command": "custom.showErrorMessage", "args": ["Make a choice", "Choice 1", "Choice 2"]} +{ + "command": "custom.showWarningMessage", + "args": ["Make a choice", "Choice 1", "Choice 2"] +} ### list installed extensions -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 +content-type: application/json + +{ "command": "custom.listInstalledExtensions" } + +### get current workspace +POST {{endpoint}} HTTP/1.1 content-type: application/json -{"command": "custom.listInstalledExtensions", "args": []} +{ "command": "custom.workspaceFolders" } -### execute command in terminal -POST http://localhost:37100 HTTP/1.1 +### execute a command in active terminal +POST {{endpoint}} HTTP/1.1 content-type: application/json -{"command": "custom.runInTerminal", "args": "ls -la"} +{ "command": "custom.runInTerminal", "args": ["ls -la"] } ### Open file at line -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 content-type: application/json -{"command": "custom.goToFileLineCharacter", "args": ["demo.py", 5, 0]} +{ + "command": "custom.goToFileLineCharacter", + "args": ["src/test/workspace1/demo.py", 5, 0] +} ### Start debugging with a custom configuration -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 content-type: application/json { @@ -44,7 +58,7 @@ content-type: application/json } ### Reveal line in current file -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 content-type: application/json { @@ -53,7 +67,7 @@ content-type: application/json } ### Go to location (the hard way) -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 content-type: application/json { @@ -62,7 +76,7 @@ content-type: application/json { "__type__": "Uri", "args": [ - "/home/ddiaz/vscode-rest-control/src/demo.py" + "/abs/path/to/src/test/workspace1/demo.py" ] }, { @@ -90,7 +104,7 @@ content-type: application/json } ### Quick pick between 3 choices -POST http://localhost:37100 HTTP/1.1 +POST {{endpoint}} HTTP/1.1 content-type: application/json { @@ -115,4 +129,31 @@ content-type: application/json } ] }] -} \ No newline at end of file +} + +### install an extension +POST {{endpoint}} HTTP/1.1 +content-type: application/json + +{ + "command": "workbench.extensions.installExtension", + "args": ["dpar39.vscode-taef-test-adapter"] +} + +### uninstall an extension +POST {{endpoint}} HTTP/1.1 +content-type: application/json + +{ + "command": "workbench.extensions.uninstallExtension", + "args": ["dpar39.vscode-taef-test-adapter"] +} + +### developer: reload window +POST {{endpoint}} HTTP/1.1 +content-type: application/json + +{ + "command": "workbench.action.reloadWindow", + "args": [] +}