From 9b9eb36d52bd6caf46efb9462ce4465a47a795d8 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 16:17:10 +0200 Subject: [PATCH 01/12] Update tests --- .gitignore | 3 ++- README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d2ae9e2..af8db29 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ node_modules bin/ debug/ target/ -obj/ \ No newline at end of file +obj/ +*.exe \ No newline at end of file diff --git a/README.md b/README.md index 7d87138..9da154e 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ This extension is designed to work with **all languages** supported by Visual St | Language | Debugger | Linux | Windows | Notes | | --- | --- | --- | --- | --- | -| Go | golang | ✅ | ❔ | | +| Go | golang | ✅ | ✅ | | | Python | [debugpy](https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy) | ✅ | ✅ | | | JavaScript | Node | ❔ | ✅ | using node.js runtime | | TypeScript | pwa-node | ✅ | ✅ | using Deno runtime | | C++ | GDB | ✅ | ❔ | | | C | GDB | ✅ | ❔ | | | Rust | lldb | ✅ | ❔ | | -| C# | - | ✅ | ❔ | dotnet 8 + 6 | +| C# | dotnet | ✅ | ✅ | dotnet 8 + 6 | ✅ tested | ❌ not working | ❔ not tested From 85d12613c3b8281369cd2374147565e7f4c5aa71 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 22:59:46 +0200 Subject: [PATCH 02/12] Add test for stack tracing - python only --- .github/workflows/lint.yml | 5 ++ .vscode/launch.json | 46 ++++++++----- package-lock.json | 124 ++++++++++++++++++++-------------- package.json | 7 +- src/test/extension.test.ts | 15 ---- src/test/runTest.ts | 23 +++++++ src/test/suite/index.ts | 38 +++++++++++ src/test/suite/python.test.ts | 64 ++++++++++++++++++ 8 files changed, 238 insertions(+), 84 deletions(-) delete mode 100644 src/test/extension.test.ts create mode 100644 src/test/runTest.ts create mode 100644 src/test/suite/index.ts create mode 100644 src/test/suite/python.test.ts diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 19327d3..4544e15 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -42,6 +42,11 @@ jobs: env: DEBIAN_FRONTEND: noninteractive + - run: sudo apt update && sudo apt install -y python + name: Install dependencies for python tests + env: + DEBIAN_FRONTEND: noninteractive + - run: Xvfb -ac :99 -screen 0 1280x1024x16 & - run: npm install - run: npm install diff --git a/.vscode/launch.json b/.vscode/launch.json index f815ee4..c5726f4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,19 +3,33 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", - "configurations": [ - { - "name": "Run Extension", - "type": "extensionHost", - "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ], - "outFiles": [ - "${workspaceFolder}/dist/*.js" - ], - "preLaunchTask": "${defaultBuildTask}" - } - ] -} + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/dist/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" + }, + { + "name": "Extension Tests", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js", + "${workspaceFolder}/dist/**/*.js" + ], + "preLaunchTask": "tasks: watch-tests" + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dc5a20b..d0899da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "call-graph", - "version": "0.0.1", + "name": "debug-graph", + "version": "0.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "call-graph", - "version": "0.0.1", + "name": "debug-graph", + "version": "0.0.2", "license": "ISC", "dependencies": { "@vscode/debugprotocol": "^1.66.0", @@ -14,15 +14,18 @@ "shared": "file:shared" }, "devDependencies": { + "@types/glob": "^8.1.0", "@types/mocha": "^10.0.7", "@types/node": "20.x", "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^7.14.1", "@typescript-eslint/parser": "^7.11.0", "@vscode/test-cli": "^0.0.9", - "@vscode/test-electron": "^2.4.0", + "@vscode/test-electron": "^2.4.1", "@vscode/vsce": "^2.31.1", "eslint": "^8.57.0", + "glob": "^8.1.0", + "mocha": "^10.2.0", "ts-loader": "^9.5.1", "typescript": "^5.5.3", "webpack": "^5.92.1", @@ -587,6 +590,16 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "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/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -599,6 +612,12 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, "node_modules/@types/mocha": { "version": "10.0.7", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.7.tgz", @@ -839,6 +858,26 @@ "node": ">=18" } }, + "node_modules/@vscode/test-cli/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@vscode/test-electron": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.4.1.tgz", @@ -2935,23 +2974,20 @@ "optional": true }, "node_modules/glob": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.3.tgz", - "integrity": "sha512-Q38SGlYRpVtDBPSWEylRyctn7uDeTp4NQERTLiCT1FqA9JXPYWqAVmQU6qh4r/zMM5ehxTcbaO8EjhWnvEhmyg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": ">=18" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2975,6 +3011,18 @@ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true }, + "node_modules/glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3514,16 +3562,13 @@ } }, "node_modules/jackspeak": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.1.tgz", - "integrity": "sha512-U23pQPDnmYybVkYjObcuYMk43VRlMLLqLI+RdZy8s8WV8WsxO9SnqSroKaluuvcNOdCAlauKszDwd+umbot5Mg==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, - "engines": { - "node": ">=18" - }, "funding": { "url": "https://github.com/sponsors/isaacs" }, @@ -3853,13 +3898,10 @@ } }, "node_modules/lru-cache": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.1.tgz", - "integrity": "sha512-9/8QXrtbGeMB6LxwQd4x1tIMnsmUxMvIH/qWGsccz6bt9Uln3S+sgAaqfQNhbGA8ufzs2fHuP/yqapGgP9Hh2g==", - "dev": true, - "engines": { - "node": ">=18" - } + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true }, "node_modules/make-dir": { "version": "4.0.0", @@ -4090,26 +4132,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/mocha/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", diff --git a/package.json b/package.json index 3932580..ce7c026 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "compile-tests": "tsc -p ./ --outDir out", "watch-tests": "tsc -p ./ -w --outDir out", "pretest": "npm run compile-tests && npm run compile && npm run lint", - "test": "vscode-test", + "test": "node ./out/test/runTest.js", "build": "npm run compile-all", "install-deps": "npm i && cd frontend && npm i" }, @@ -77,12 +77,15 @@ "@types/mocha": "^10.0.7", "@types/node": "20.x", "@types/vscode": "^1.91.0", + "@types/glob": "^8.1.0", "@typescript-eslint/eslint-plugin": "^7.14.1", "@typescript-eslint/parser": "^7.11.0", "@vscode/test-cli": "^0.0.9", - "@vscode/test-electron": "^2.4.0", + "@vscode/test-electron": "^2.4.1", "@vscode/vsce": "^2.31.1", "eslint": "^8.57.0", + "glob": "^8.1.0", + "mocha": "^10.2.0", "ts-loader": "^9.5.1", "typescript": "^5.5.3", "webpack": "^5.92.1", diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts deleted file mode 100644 index 4ca0ab4..0000000 --- a/src/test/extension.test.ts +++ /dev/null @@ -1,15 +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 vscode from 'vscode'; -// import * as myExtension from '../../extension'; - -suite('Extension Test Suite', () => { - vscode.window.showInformationMessage('Start all tests.'); - - test('Sample test', () => { - assert.strictEqual(-1, [1, 2, 3].indexOf(5)); - assert.strictEqual(-1, [1, 2, 3].indexOf(0)); - }); -}); diff --git a/src/test/runTest.ts b/src/test/runTest.ts new file mode 100644 index 0000000..93a4441 --- /dev/null +++ b/src/test/runTest.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; + +import { runTests } from '@vscode/test-electron'; + +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 + await runTests({ extensionDevelopmentPath, extensionTestsPath }); + } catch (err) { + console.error('Failed to run tests', err); + process.exit(1); + } +} + +main(); diff --git a/src/test/suite/index.ts b/src/test/suite/index.ts new file mode 100644 index 0000000..5313e9c --- /dev/null +++ b/src/test/suite/index.ts @@ -0,0 +1,38 @@ +import * as path from 'path'; +import Mocha from 'mocha'; +import glob from 'glob'; + +export function run(): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: 'tdd', + color: true + }); + + const testsRoot = path.resolve(__dirname, '..'); + + return new Promise((c, e) => { + glob('**/**.test.js', { cwd: testsRoot }, (err: any, files: any) => { + if (err) { + return e(err); + } + + // Add files to the test suite + files.forEach((f: any) => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + console.error(err); + e(err); + } + }); + }); +} diff --git a/src/test/suite/python.test.ts b/src/test/suite/python.test.ts new file mode 100644 index 0000000..fd6db09 --- /dev/null +++ b/src/test/suite/python.test.ts @@ -0,0 +1,64 @@ +import * as assert from 'assert'; +import path from 'path'; +import * as vscode from 'vscode'; +import { getStacktraceInfo } from '../../debug/callstack-extractor'; + +suite('Test python compatibility', function () { + this.timeout(60_000); + + this.beforeAll(async () => { + await vscode.extensions.getExtension('ms-python.debugpy')!.activate(); + await vscode.extensions.getExtension('ms-python.python')!.activate(); + }); + + this.afterAll(async () => { + vscode.debug.stopDebugging(); + vscode.debug.removeBreakpoints(vscode.debug.breakpoints); + }); + + test('Test Call Stack', async () => { + const extensionDevelopmentPath = path.resolve(__dirname, '../../../test_code/'); + const workspaceFolderPath = path.join(extensionDevelopmentPath, 'python'); + const workspaceTestFilePath = path.join(workspaceFolderPath, 'main.py'); + + const mainFileUri = vscode.Uri.file(workspaceTestFilePath); + + const success = vscode.workspace.updateWorkspaceFolders( + vscode.workspace.workspaceFolders + ? vscode.workspace.workspaceFolders.length + : 0, + null, { uri: vscode.Uri.from({ scheme: 'file', path: workspaceFolderPath }), name: 'python_code' }); + + assert.ok(success, 'Failed to add workspace folder'); + + const breakpoints = [ + new vscode.SourceBreakpoint(new vscode.Location(mainFileUri, new vscode.Position(13, 0))), + new vscode.SourceBreakpoint(new vscode.Location(mainFileUri, new vscode.Position(38, 0))), + ]; + + vscode.debug.addBreakpoints(breakpoints); + + const config: vscode.DebugConfiguration = { + type: 'python', + request: 'launch', + name: 'Launch Program', + program: mainFileUri.fsPath, + }; + + const workspace = vscode.workspace.workspaceFolders?.[0]; + + const onStackItemChanged = new Promise((resolve) => vscode.debug.onDidChangeActiveStackItem(() => resolve())); + await vscode.debug.startDebugging(workspace, config); + await onStackItemChanged; + + const stackTraceInfo = await getStacktraceInfo(); + assert.ok(stackTraceInfo, 'Failed to get stack trace info'); + // asset only the first and last stack frame for now + assert.equal(stackTraceInfo.length, 4, 'Did not get the expected number of stack frames'); + assert.equal(stackTraceInfo[0].locationInCode.startLine, 2, 'Did not get the expected line inside function'); + assert.equal(stackTraceInfo[0].fileLocationOffset.startLine, 11, 'Did not get the expected offset in file'); + + assert.equal(stackTraceInfo[3].locationInCode.startLine, 3, 'Did not get the expected line inside function'); + assert.equal(stackTraceInfo[3].fileLocationOffset.startLine, 41, 'Did not get the expected offset in file'); + }); +}); From 461e8043afb5314b31fcc0acc299a5b1dd28c873 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:02:54 +0200 Subject: [PATCH 03/12] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4544e15..368bfd3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -42,7 +42,7 @@ jobs: env: DEBIAN_FRONTEND: noninteractive - - run: sudo apt update && sudo apt install -y python + - run: sudo apt update && sudo apt install -y python3 name: Install dependencies for python tests env: DEBIAN_FRONTEND: noninteractive From a3773f8021c2e176b7bec6cbef351f9322fc6ffa Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:10:03 +0200 Subject: [PATCH 04/12] Update runTest.ts --- src/test/runTest.ts | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/test/runTest.ts b/src/test/runTest.ts index 93a4441..127e94a 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -3,21 +3,24 @@ import * as path from 'path'; import { runTests } from '@vscode/test-electron'; async function main() { - try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` - const extensionDevelopmentPath = path.resolve(__dirname, '../../'); + 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 - await runTests({ extensionDevelopmentPath, extensionTestsPath }); - } catch (err) { - console.error('Failed to run tests', err); - process.exit(1); - } + // The path to test runner + const extensionTestsPath = path.resolve(__dirname, './suite/index'); + const launchArgs = [ + '--disable-extensions', + '--install-extension=ms-python.debugpy', + '--install-extension=ms-python.python' + ]; + // Download VS Code, unzip it and run the integration test + await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs }); + } catch (err) { + console.error('Failed to run tests', err); + process.exit(1); + } } main(); From 4d46bce1e71ba5580a39c4a4137fc5ad111fe926 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:13:58 +0200 Subject: [PATCH 05/12] Update python.test.ts --- src/test/suite/python.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/suite/python.test.ts b/src/test/suite/python.test.ts index fd6db09..b50a154 100644 --- a/src/test/suite/python.test.ts +++ b/src/test/suite/python.test.ts @@ -7,11 +7,11 @@ suite('Test python compatibility', function () { this.timeout(60_000); this.beforeAll(async () => { - await vscode.extensions.getExtension('ms-python.debugpy')!.activate(); - await vscode.extensions.getExtension('ms-python.python')!.activate(); + await vscode.extensions.getExtension('ms-python.debugpy')?.activate(); + await vscode.extensions.getExtension('ms-python.python')?.activate(); }); - this.afterAll(async () => { + this.afterEach(async () => { vscode.debug.stopDebugging(); vscode.debug.removeBreakpoints(vscode.debug.breakpoints); }); From 2ecce37c8570bf1163b371d7cc8647b7a59decce Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:34:55 +0200 Subject: [PATCH 06/12] Fix tests (hopfully) --- .github/workflows/lint.yml | 45 +++++++++++++++++++++++++++++--------- src/test/runTest.ts | 6 +++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 368bfd3..8be706f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,7 +1,8 @@ +name: Lint and Test Extension + on: push: -name: Lint Extension jobs: lint: runs-on: ubuntu-latest @@ -37,21 +38,45 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - run: sudo apt update && sudo apt install -y xvfb libgtk-3-0 libnss3 libxss1 libasound2 libx11-xcb1 - name: install virtual display - env: - DEBIAN_FRONTEND: noninteractive - - run: sudo apt update && sudo apt install -y python3 - name: Install dependencies for python tests + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y xvfb libgtk-3-0 libnss3 libxss1 libasound2 libx11-xcb1 libxkbfile1 libsecret-1-0 python3 python3-pip env: DEBIAN_FRONTEND: noninteractive - - run: Xvfb -ac :99 -screen 0 1280x1024x16 & + - name: Check Python version + run: python3 --version + + - name: Install Python dependencies + run: | + if [ -f requirements.txt ]; then + pip3 install -r requirements.txt + fi + + - name: Start Xvfb + run: | + Xvfb :99 -ac -screen 0 1280x1024x24 -verbose > xvfb.log 2>&1 & + echo "Started Xvfb" + sleep 3 # Give Xvfb some time to start + + - name: Set DISPLAY environment variable + run: | + echo "DISPLAY=:99" >> $GITHUB_ENV + - run: npm install + - run: npm install working-directory: ./frontend - - run: npm run test - name: Test VSCode + + - name: Test VSCode + run: xvfb-run --auto-servernum npm run test env: DISPLAY: ":99" + LIBGL_ALWAYS_SOFTWARE: "1" + MESA_GL_VERSION_OVERRIDE: "4.0" + + - name: Display Xvfb log if tests failed + if: failure() + run: cat xvfb.log diff --git a/src/test/runTest.ts b/src/test/runTest.ts index 127e94a..e34cb38 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -11,12 +11,14 @@ async function main() { // The path to test runner const extensionTestsPath = path.resolve(__dirname, './suite/index'); const launchArgs = [ + '--disable-gpu', '--disable-extensions', + '--disable-workspace-trust', '--install-extension=ms-python.debugpy', - '--install-extension=ms-python.python' + '--install-extension=ms-python.python', ]; // Download VS Code, unzip it and run the integration test - await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs }); + await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs, version: 'stable' }); } catch (err) { console.error('Failed to run tests', err); process.exit(1); From ec1f6366ff5981469eabd6c53be902a357e98432 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:38:08 +0200 Subject: [PATCH 07/12] Fix test (hopfully) --- .github/workflows/lint.yml | 6 ++---- src/test/runTest.ts | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8be706f..ca271c1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -76,7 +76,5 @@ jobs: DISPLAY: ":99" LIBGL_ALWAYS_SOFTWARE: "1" MESA_GL_VERSION_OVERRIDE: "4.0" - - - name: Display Xvfb log if tests failed - if: failure() - run: cat xvfb.log + PYTHONPATH: ${{ github.workspace }} + PYTHON_EXECUTABLE: $(which python3) diff --git a/src/test/runTest.ts b/src/test/runTest.ts index e34cb38..3a7cd06 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -12,7 +12,6 @@ async function main() { const extensionTestsPath = path.resolve(__dirname, './suite/index'); const launchArgs = [ '--disable-gpu', - '--disable-extensions', '--disable-workspace-trust', '--install-extension=ms-python.debugpy', '--install-extension=ms-python.python', From 95709c22166bc2bcc96ef25b4f8f5b83a2d83aa9 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:39:13 +0200 Subject: [PATCH 08/12] Update lint.yml --- .github/workflows/lint.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ca271c1..116a1e1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,11 +70,7 @@ jobs: - run: npm install working-directory: ./frontend - - name: Test VSCode - run: xvfb-run --auto-servernum npm run test - env: - DISPLAY: ":99" - LIBGL_ALWAYS_SOFTWARE: "1" - MESA_GL_VERSION_OVERRIDE: "4.0" - PYTHONPATH: ${{ github.workspace }} - PYTHON_EXECUTABLE: $(which python3) + - name: Run tests + uses: GabrielBB/xvfb-action@v1 + with: + run: npm test From 51fa9035fea8fe342229a04bc65af4dc4c2055a2 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:43:34 +0200 Subject: [PATCH 09/12] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 116a1e1..98f2f02 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -73,4 +73,4 @@ jobs: - name: Run tests uses: GabrielBB/xvfb-action@v1 with: - run: npm test + run: npm run test From 5d60702189a0c6d367667ad9041625c5da352ecf Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:46:24 +0200 Subject: [PATCH 10/12] Update lint.yml --- .github/workflows/lint.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 98f2f02..af352b5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -70,7 +70,4 @@ jobs: - run: npm install working-directory: ./frontend - - name: Run tests - uses: GabrielBB/xvfb-action@v1 - with: - run: npm run test + - run: npm run test From a393a0fcba27774a75222229329175faa62b6c49 Mon Sep 17 00:00:00 2001 From: K0IN Date: Sun, 28 Jul 2024 23:48:39 +0200 Subject: [PATCH 11/12] Update lint.yml --- .github/workflows/lint.yml | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index af352b5..8d73f1a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -46,28 +46,13 @@ jobs: env: DEBIAN_FRONTEND: noninteractive - - name: Check Python version - run: python3 --version - - - name: Install Python dependencies - run: | - if [ -f requirements.txt ]; then - pip3 install -r requirements.txt - fi - - - name: Start Xvfb - run: | - Xvfb :99 -ac -screen 0 1280x1024x24 -verbose > xvfb.log 2>&1 & - echo "Started Xvfb" - sleep 3 # Give Xvfb some time to start - - - name: Set DISPLAY environment variable - run: | - echo "DISPLAY=:99" >> $GITHUB_ENV - - run: npm install - run: npm install working-directory: ./frontend - - run: npm run test + - name: Run tests + run: | + export DISPLAY=':99.0' + Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + npm test From 7263ca97a94ea42e812a721651096ab888888266 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:31:01 +0000 Subject: [PATCH 12/12] Bump @types/node from 20.14.10 to 22.0.0 in /frontend Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.14.10 to 22.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- frontend/package-lock.json | 16 ++++++++-------- frontend/package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 33afa3c..a081d7d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -18,7 +18,7 @@ "devDependencies": { "@rushstack/eslint-patch": "^1.8.0", "@tsconfig/node20": "^20.1.4", - "@types/node": "^20.14.5", + "@types/node": "^22.0.0", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue-jsx": "^4.0.0", @@ -1525,12 +1525,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", - "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz", + "integrity": "sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw==", "dev": true, "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.11.1" } }, "node_modules/@types/vscode-webview": { @@ -4509,9 +4509,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz", + "integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==", "dev": true }, "node_modules/universalify": { diff --git a/frontend/package.json b/frontend/package.json index 87e69d6..1651873 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,7 +24,7 @@ "devDependencies": { "@rushstack/eslint-patch": "^1.8.0", "@tsconfig/node20": "^20.1.4", - "@types/node": "^20.14.5", + "@types/node": "^22.0.0", "@types/vscode-webview": "^1.57.5", "@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue-jsx": "^4.0.0",