From ef30795be775a9482c48973873e10b4245c39ec4 Mon Sep 17 00:00:00 2001 From: Darien Pardinas Diaz Date: Sun, 19 May 2024 21:06:39 -0400 Subject: [PATCH] Renamed pipeline --- .github/workflows/{release.yml => cicd.yml} | 6 +++--- .vscode/launch.json | 2 +- CHANGELOG.md | 6 ++++++ src/extension.ts | 2 +- src/test/runTest.ts | 2 +- src/test/suite/extension.test.ts | 3 +++ src/test/workspace1/demo.py | 4 +++- src/test/workspace1/samples.http | 2 +- 8 files changed, 19 insertions(+), 8 deletions(-) rename .github/workflows/{release.yml => cicd.yml} (87%) diff --git a/.github/workflows/release.yml b/.github/workflows/cicd.yml similarity index 87% rename from .github/workflows/release.yml rename to .github/workflows/cicd.yml index 1bcb43a..3f29e08 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/cicd.yml @@ -1,4 +1,4 @@ -name: Release +name: CI/CD pipeline on: pull_request: push: @@ -8,7 +8,7 @@ on: jobs: build: - name: "Build and release" + name: "Build, test and release" runs-on: ubuntu-latest steps: @@ -22,7 +22,7 @@ jobs: run: npm install - name: Build and run automation tests - run: xvfb-run -a npm run test + run: npm run test - name: Publish to VSCode Marketplace if: ${{ github.ref == 'refs/heads/main' }} diff --git a/.vscode/launch.json b/.vscode/launch.json index 96c227b..dbdebaf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,7 +21,7 @@ "type": "extensionHost", "request": "launch", "args": [ - "${workspaceFolder}/test/workspace1", + "${workspaceFolder}/src/test/workspace1", "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" ], diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d83242..b5ae1f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## [0.0.5] + +- Added `custom.workspaceFile` and `custom.workspaceFolders` to retrieve the workspace file (if any) and folders currently opened in the workspace (if any) + +- Added `custom.getCommands` to retrieve the full list of commands registered within vscode + ## [0.0.4] - Removed npm vulnerabilities diff --git a/src/extension.ts b/src/extension.ts index d1c3fba..b23ece1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -60,7 +60,7 @@ const startHttpServer = async ( processRemoteControlRequest(reqData as ControlRequest) .then((data) => { res.setHeader("Content-Type", "application/json"); - res.write(JSON.stringify(data || {})); + res.write(JSON.stringify(data || null)); res.end(); }) .catch((err) => { diff --git a/src/test/runTest.ts b/src/test/runTest.ts index b6139ab..9b18750 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -13,7 +13,7 @@ async function main() { const extensionTestsPath = path.resolve(__dirname, "./suite/index"); // Get the directory path to a sample workspace - const workspace1 = path.resolve(__dirname, "./workspace1"); + const workspace1 = path.resolve(extensionDevelopmentPath, "src/test/workspace1"); // VSCode launch arguments const launchArgs = [workspace1]; diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index 237cc40..2d2141f 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -23,6 +23,9 @@ suite("Extension Test Suite", () => { assert(ws.index === 0); assert(ws.uri.startsWith("file://")); assert(ws.uri.endsWith("/workspace1")); + + const workspaceFile = await makeRequest("custom.workspaceFile") as any; + assert(workspaceFile === null); // no workspace file }); test("get all commands registred in vscode", async () => { diff --git a/src/test/workspace1/demo.py b/src/test/workspace1/demo.py index 9a66bba..f386b85 100644 --- a/src/test/workspace1/demo.py +++ b/src/test/workspace1/demo.py @@ -4,7 +4,9 @@ from time import sleep -def post_data(data, url="http://localhost:37100"): +def post_data(data): + port = os.environ.get("REMOTE_CONTROL_PORT", "37100") + url = f"http://localhost:{port}" body = json.dumps(data).encode("utf-8") headers = {"Content-Type": "application/json"} req = request.Request(url, body, headers) diff --git a/src/test/workspace1/samples.http b/src/test/workspace1/samples.http index 1f68101..1675392 100644 --- a/src/test/workspace1/samples.http +++ b/src/test/workspace1/samples.http @@ -1,4 +1,4 @@ -@endpoint = http://localhost:43285 +@endpoint = http://localhost:37100 ### show a warning message in vscode and get a choice selection POST {{endpoint}} HTTP/1.1