From bdf43a6962f3f35fb841745ed0cb852ed93ad964 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 14:24:18 -0700 Subject: [PATCH 01/12] Update package scripts to include watch tasks --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f2f3c8c273..154d31c71b 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,11 @@ "main": "./out/main.js", "scripts": { "lint": "eslint . --ext .ts", - "build": "tsc --project tsconfig.json && esbuild ./src/main.ts --outdir=out --bundle --external:vscode --platform=node", - "test": "node ./out/test/runTests.js", + "build": "esbuild ./src/main.ts --outdir=out --bundle --external:vscode --platform=node", + "build-watch": "npm run build -- --watch", + "build-test": "tsc --incremental", + "build-test-watch": "npm run build-test -- --watch", + "test": "npm run build-test && node ./out/test/runTests.js", "package": "vsce package --no-gitHubIssueLinking", "publish": "vsce publish" }, From dbbba29e4396ec55ed6cf1a3e70dea2ce3480514 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 14:24:44 -0700 Subject: [PATCH 02/12] Move Initial Testing CWD to empty workspace --- .gitignore | 2 +- test/.vscode/settings.json | 7 ------- test/core/settings.test.ts | 26 ++++++++++++-------------- test/runTests.ts | 17 ++++++++--------- 4 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 test/.vscode/settings.json diff --git a/.gitignore b/.gitignore index 100457c404..2b428647ba 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ bin/ out/ sessions/ test/.vscode/ - +test/mocks/EmptyWorkspace test-results.xml *.vsix *.DS_Store diff --git a/test/.vscode/settings.json b/test/.vscode/settings.json deleted file mode 100644 index b731d24659..0000000000 --- a/test/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "terminal.integrated.shellIntegration.enabled": false, - "powershell.enableProfileLoading": false, - "powershell.powerShellAdditionalExePaths": { - "Some PowerShell": "somePath" - }, -} diff --git a/test/core/settings.test.ts b/test/core/settings.test.ts index 00b1c5d5ee..b0f780d95f 100644 --- a/test/core/settings.test.ts +++ b/test/core/settings.test.ts @@ -3,34 +3,32 @@ import * as assert from "assert"; import * as vscode from "vscode"; -import * as settings from "../../src/settings"; +import { Settings, getSettings, getEffectiveConfigurationTarget, changeSetting, CommentType } from "../../src/settings"; -describe("Settings module", function () { +describe.only("Settings E2E", function () { + this.slow(800); it("Loads without error", function () { - assert.doesNotThrow(settings.getSettings); + assert.doesNotThrow(getSettings); }); it("Loads the correct defaults", function () { - const testSettings = new settings.Settings(); - testSettings.enableProfileLoading = false; - testSettings.powerShellAdditionalExePaths = { "Some PowerShell": "somePath" }; - const actualSettings = settings.getSettings(); + const testSettings = new Settings(); + const actualSettings = getSettings(); assert.deepStrictEqual(actualSettings, testSettings); }); - it("Updates correctly", async function () { - await settings.changeSetting("helpCompletion", settings.CommentType.LineComment, false, undefined); - assert.strictEqual(settings.getSettings().helpCompletion, settings.CommentType.LineComment); + await changeSetting("helpCompletion", CommentType.LineComment, false, undefined); + assert.strictEqual(getSettings().helpCompletion, CommentType.LineComment); }); it("Gets the effective configuration target", async function () { - await settings.changeSetting("helpCompletion", settings.CommentType.LineComment, false, undefined); - let target = settings.getEffectiveConfigurationTarget("helpCompletion"); + await changeSetting("helpCompletion", CommentType.LineComment, false, undefined); + let target = getEffectiveConfigurationTarget("helpCompletion"); assert.strictEqual(target, vscode.ConfigurationTarget.Workspace); - await settings.changeSetting("helpCompletion", undefined, false, undefined); - target = settings.getEffectiveConfigurationTarget("helpCompletion"); + await changeSetting("helpCompletion", undefined, false, undefined); + target = getEffectiveConfigurationTarget("helpCompletion"); assert.strictEqual(target, undefined); }); }); diff --git a/test/runTests.ts b/test/runTests.ts index 961ac3819d..be54a7f5d5 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -18,24 +18,24 @@ async function main(): Promise { } try { - // The folder containing the Extension Manifest package.json - // Passed to `--extensionDevelopmentPath` + /** The folder containing the Extension Manifest package.json. Passed to `--extensionDevelopmentPath */ const extensionDevelopmentPath = path.resolve(__dirname, "../../"); - // The path to the extension test script - // Passed to --extensionTestsPath + /** The path to the extension test script. Passed to --extensionTestsPath */ const extensionTestsPath = path.resolve(__dirname, "./index"); - // The version to test. By default we test on insiders. + /** The starting workspace/folder to open in vscode */ + const workspaceToOpen = path.resolve(extensionDevelopmentPath, "test/mocks/EmptyWorkspace"); + + /** The version to test. By default we test on insiders. */ const vsCodeVersion = "insiders"; - // Install Temp VSCode. We need to do this first so we can then install extensions as the runTests function doesn't give us a way to hook in to do this. + /** Install a temporary vscode. This must be done ahead of RunTests in order to install extensions ahead of time. @see https://github.com/microsoft/vscode-test/blob/addc23e100b744de598220adbbf0761da870eda9/README.md?plain=1#L71-L89 **/ const testVSCodePath = await downloadAndUnzipVSCode(vsCodeVersion, undefined, new ConsoleReporter(true)); InstallExtension(testVSCodePath, "ms-dotnettools.csharp"); - // Open VSCode with the examples folder, so any UI testing can run against the examples. const launchArgs = [ - "./test" + workspaceToOpen ]; // Allow to wait for extension test debugging @@ -58,7 +58,6 @@ async function main(): Promise { } } - /** Installs an extension into an existing vscode instance. Returns the output result */ function InstallExtension(vscodeExePath: string, extensionIdOrVSIXPath: string): string { // Install the csharp extension which is required for the dotnet debugger testing From f3fc090d3cec5e9d4a2769f041ad93a4ee908579 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 14:48:53 -0700 Subject: [PATCH 03/12] Add env var options for RunTests --- test/runTests.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/runTests.ts b/test/runTests.ts index be54a7f5d5..f41d84a463 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -24,11 +24,12 @@ async function main(): Promise { /** The path to the extension test script. Passed to --extensionTestsPath */ const extensionTestsPath = path.resolve(__dirname, "./index"); - /** The starting workspace/folder to open in vscode */ - const workspaceToOpen = path.resolve(extensionDevelopmentPath, "test/mocks/EmptyWorkspace"); + /** The starting workspace/folder to open in vscode. */ + const workspacePath = process.env.__TEST_WORKSPACE_PATH ?? "test/mocks/EmptyWorkspace"; + const workspaceToOpen = path.resolve(extensionDevelopmentPath, workspacePath); /** The version to test. By default we test on insiders. */ - const vsCodeVersion = "insiders"; + const vsCodeVersion = process.env.__TEST_VSCODE_VERSION ?? "insiders"; /** Install a temporary vscode. This must be done ahead of RunTests in order to install extensions ahead of time. @see https://github.com/microsoft/vscode-test/blob/addc23e100b744de598220adbbf0761da870eda9/README.md?plain=1#L71-L89 **/ const testVSCodePath = await downloadAndUnzipVSCode(vsCodeVersion, undefined, new ConsoleReporter(true)); From b2819b6a1ab159e3016563fef9f2e6fbd1cc5771 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 15:09:29 -0700 Subject: [PATCH 04/12] Improve workspace config with better formatting and isolated launch configs --- extension-dev.code-workspace | 211 ++++++++++++++++++++++++++++++++--- 1 file changed, 193 insertions(+), 18 deletions(-) diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace index dc9f8bfeab..7fe06b5c56 100644 --- a/extension-dev.code-workspace +++ b/extension-dev.code-workspace @@ -21,6 +21,7 @@ ] }, "settings": { + "debug.onTaskErrors": "prompt", "editor.tabSize": 4, "editor.insertSpaces": true, "files.trimTrailingWhitespace": true, @@ -44,7 +45,17 @@ "powershell.codeFormatting.whitespaceBetweenParameters": true, "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", // Lock the TypeScript SDK path to the version we use - "typescript.tsdk": "Client/node_modules/typescript/lib" + "typescript.tsdk": "Client/node_modules/typescript/lib", + // Code actions like "organize imports" ignore eslint, so we need this here + "typescript.format.semicolons": "insert", + // Enable ESLint as defaut formatter so quick fixes can be applied directly + "eslint.format.enable": true, + "[typescript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modificationsIfAvailable" + } }, "tasks": { "version": "2.0.0", @@ -90,7 +101,7 @@ "options": { "cwd": "${workspaceFolder:Client}" }, - "command": "Invoke-Build Build", + "command": "./build.ps1", "problemMatcher": [ "$msCompile", "$tsc" @@ -106,7 +117,7 @@ "options": { "cwd": "${workspaceFolder:Client}" }, - "command": "Invoke-Build Test", + "command": "./build.ps1 -Test", "problemMatcher": [ "$msCompile", "$tsc" @@ -148,7 +159,39 @@ }, "command": "Invoke-Build ${input:serverBuildCommand}", "group": "build" - } + }, + // HACK: Can't use task type npm in workspace config: https://github.com/microsoft/vscode/issues/96086 + { + "label": "test-watch", + "icon": { + "color": "terminal.ansiCyan", + "id": "sync" + }, + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "npm run-script build-test-watch", + "group": "test", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "dependsOn": "build-watch" // We need to also build main.js extension for testing or it leads to sourcemap errors + }, + { + "label": "build-watch", + "icon": { + "color": "terminal.ansiCyan", + "id": "sync" + }, + "type": "shell", + "options": { + "cwd": "${workspaceFolder:Client}" + }, + "command": "npm run-script build-watch", + "group": "build", + "problemMatcher": "$esbuild-watch", + "isBackground": true, + }, ], "inputs": [ { @@ -184,7 +227,52 @@ }, "launch": { "version": "0.2.0", + "compounds": [ + { + "name": "Test Extension", + "configurations": [ + "ExtensionTests", + "ExtensionTestRunner", + ], + "stopAll": true, + "presentation": { + "group": "test", + "order": 1 + }, + // This is here so instead of under TestRunner so that the attach doesn't start until the compile is complete + "preLaunchTask": "test-watch" + } + ], "configurations": [ + { + "name": "Launch Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder:Client}" + ], + "env": { + "__TEST_WORKSPACE_PATH": "${workspaceFolder:Client}/examples", + }, + "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/out/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" + ], + "presentation": { + "hidden": false, + "group": "test", + "order": 2 + } + }, { // https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md "name": "Attach to Editor Services", @@ -197,42 +285,129 @@ "searchPaths": [], "searchMicrosoftSymbolServer": true, "searchNuGetOrgSymbolServer": true + }, + "presentation": { + "hidden": false, + "group": "test", + "order": 3 } }, { - "name": "Launch Extension", + // Runs the extension in an empty temp profile that is automatically cleaned up after use + // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 + "name": "Launch Extension - Temp Profile", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--disable-extensions", - "--extensionDevelopmentPath=${workspaceFolder:Client}" + "--profile-temp", + "--extensionDevelopmentPath=${workspaceFolder:Client}", + "${workspaceFolder:Client}/examples" ], "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly "outFiles": [ - "${workspaceFolder:Client}/out/main.js" + "${workspaceFolder:Client}/out/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" ], - "preLaunchTask": "${defaultBuildTask}", + "presentation": { + "hidden": false, + "group": "test", + "order": 2 + } }, { - "name": "Launch Extension Tests", + // Runs the extension in an isolated but persistent profile separate from the user settings + // Undocumented: https://github.com/microsoft/vscode-docs/issues/6220 + "name": "Launch Extension - Isolated Profile", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - // The tests require Code be opened with a workspace, which exists in - // `test`, but this has to be passed as a CLI argument, not just `cwd`. - "${workspaceFolder:Client}/test", - "--disableExtensions", + "--profile=debug", "--extensionDevelopmentPath=${workspaceFolder:Client}", - "--extensionTestsPath=${workspaceFolder:Client}/out/test/index.js", + "${workspaceFolder:Client}/examples" ], "sourceMaps": true, + // This speeds up source map detection and makes smartStep work correctly "outFiles": [ - "${workspaceFolder:Client}/out/test/**/*.js" + "${workspaceFolder:Client}/out/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" + ], + "presentation": { + "hidden": false, + "group": "test", + "order": 2 + } + }, + { + "name": "ExtensionTestRunner", + "type": "node", + "request": "launch", + "program": "${workspaceFolder:Client}/out/test/runTests.js", + "cascadeTerminateToConfigurations": [ + "ExtensionTests", + ], + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/out/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" + ], + "args": [ + "59229" // Wait on this port for the separate debugger task to attach + ], + "presentation": { + "hidden": true, + }, + "internalConsoleOptions": "neverOpen", + "console": "integratedTerminal", + "autoAttachChildProcesses": false // Doesnt work with the extension host for whatever reason, hence the separate attach. + }, + { + "name": "ExtensionTests", + "type": "node", + "request": "attach", + "port": 59229, + "autoAttachChildProcesses": true, + "outputCapture": "console", + "continueOnAttach": true, + // Sometimes we may need to install extensions or reload the window which requires reconnecting + "restart": { + "delay": 1000, + "maxAttempts": 3 + }, + "presentation": { + "hidden": true, + }, + // This speeds up source map detection and makes smartStep work correctly + "outFiles": [ + "${workspaceFolder:Client}/out/**/*.js", + "!**/node_modules/**", + "!**/.vscode-test/**" + ], + "skipFiles": [ + "/**", + "**/node_modules/**", + "**/.vscode-test/**" ], - "preLaunchTask": "${defaultBuildTask}", - "internalConsoleOptions": "openOnSessionStart" } ] } From 0e3428f8917ad652a0b6d98b9e50d11d2cc6e25b Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 15:25:48 -0700 Subject: [PATCH 05/12] Add .keep to ensure EmptyWorkspace gets created on checkout --- test/mocks/EmptyWorkspace/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/mocks/EmptyWorkspace/.keep diff --git a/test/mocks/EmptyWorkspace/.keep b/test/mocks/EmptyWorkspace/.keep new file mode 100644 index 0000000000..e69de29bb2 From a6601c09956bd55b603b443ad7130094f84e528c Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 15:28:47 -0700 Subject: [PATCH 06/12] Enable allowSyntheticDefaultImports to allow for more natural default imports rather than "* as" syntax --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 4da3d70d92..4db014f3af 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,8 @@ "noImplicitReturns": true, "noUnusedLocals": true, "noUnusedParameters": true, - "esModuleInterop": true + "esModuleInterop": true, + "allowSyntheticDefaultImports": true }, "include": [ "src", "test" ], } From d644fa5408adcf0c34d849aa27fc516c0ae11040 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 16:24:55 -0700 Subject: [PATCH 07/12] Move test root to "Mocks" --- .gitignore | 3 +-- test/core/settings.test.ts | 2 +- test/features/DebugSession.test.ts | 9 +++++---- test/mocks/EmptyWorkspace/.keep | 0 test/runTests.ts | 7 +++++-- 5 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 test/mocks/EmptyWorkspace/.keep diff --git a/.gitignore b/.gitignore index 2b428647ba..b260098f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,7 @@ obj/ bin/ out/ sessions/ -test/.vscode/ -test/mocks/EmptyWorkspace +test/**/.vscode test-results.xml *.vsix *.DS_Store diff --git a/test/core/settings.test.ts b/test/core/settings.test.ts index b0f780d95f..fcd1856a61 100644 --- a/test/core/settings.test.ts +++ b/test/core/settings.test.ts @@ -5,7 +5,7 @@ import * as assert from "assert"; import * as vscode from "vscode"; import { Settings, getSettings, getEffectiveConfigurationTarget, changeSetting, CommentType } from "../../src/settings"; -describe.only("Settings E2E", function () { +describe("Settings E2E", function () { this.slow(800); it("Loads without error", function () { assert.doesNotThrow(getSettings); diff --git a/test/features/DebugSession.test.ts b/test/features/DebugSession.test.ts index cd36993ca6..9080fc1064 100644 --- a/test/features/DebugSession.test.ts +++ b/test/features/DebugSession.test.ts @@ -419,7 +419,9 @@ describe("DebugSessionFeature E2E", function slowTests() { }); describe("Binary Modules", () => { + let binaryModulePath: Uri; before(async () => { + binaryModulePath = Uri.joinPath(workspace.workspaceFolders![0].uri, "BinaryModule"); BuildBinaryModuleMock(); await ensureEditorServicesIsConnected(); }); @@ -430,7 +432,7 @@ describe("DebugSessionFeature E2E", function slowTests() { it("Debugs a binary module script", async () => { const launchScriptConfig = structuredClone(defaultDebugConfigurations[DebugConfig.LaunchScript]); - launchScriptConfig.script = "../examples/BinaryModule/BinaryModuleTest.ps1"; + launchScriptConfig.script = Uri.joinPath(binaryModulePath, "BinaryModuleTest.ps1").fsPath; launchScriptConfig.attachDotnetDebugger = true; launchScriptConfig.createTemporaryIntegratedConsole = true; const startDebugging = Sinon.spy(debug, "startDebugging"); @@ -454,8 +456,8 @@ describe("DebugSessionFeature E2E", function slowTests() { const launchScriptConfig = structuredClone(defaultDebugConfigurations[DebugConfig.LaunchCurrentFile]); launchScriptConfig.attachDotnetDebugger = true; launchScriptConfig.createTemporaryIntegratedConsole = true; - const testScriptPath = Uri.joinPath(workspace.workspaceFolders![0].uri, "mocks/BinaryModule/BinaryModuleTest.ps1"); - const cmdletSourcePath = Uri.joinPath(workspace.workspaceFolders![0].uri, "mocks/BinaryModule/TestSampleCmdletCommand.cs"); + const testScriptPath = Uri.joinPath(binaryModulePath, "BinaryModuleTest.ps1"); + const cmdletSourcePath = Uri.joinPath(binaryModulePath, "TestSampleCmdletCommand.cs"); const testScriptDocument = await workspace.openTextDocument(testScriptPath); await window.showTextDocument(testScriptDocument); @@ -463,7 +465,6 @@ describe("DebugSessionFeature E2E", function slowTests() { //We wire this up before starting the debug session so the event is registered const dotnetDebugSessionActive = WaitEvent(debug.onDidChangeActiveDebugSession, (session) => { - console.log(`Debug Session Changed: ${session?.name}`); return !!session?.name.match(/Dotnet Debugger/); }); diff --git a/test/mocks/EmptyWorkspace/.keep b/test/mocks/EmptyWorkspace/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/runTests.ts b/test/runTests.ts index f41d84a463..3bff3ddeac 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -25,7 +25,7 @@ async function main(): Promise { const extensionTestsPath = path.resolve(__dirname, "./index"); /** The starting workspace/folder to open in vscode. */ - const workspacePath = process.env.__TEST_WORKSPACE_PATH ?? "test/mocks/EmptyWorkspace"; + const workspacePath = process.env.__TEST_WORKSPACE_PATH ?? "test/mocks"; const workspaceToOpen = path.resolve(extensionDevelopmentPath, workspacePath); /** The version to test. By default we test on insiders. */ @@ -51,7 +51,10 @@ async function main(): Promise { launchArgs: launchArgs, // This is necessary because the tests fail if more than once // instance of Code is running. - version: vsCodeVersion + version: vsCodeVersion, + extensionTestsEnv: { + __TEST_EXTENSIONDEVELOPMENTPATH: extensionDevelopmentPath + } }); } catch (err) { console.error(`Failed to run tests: ${err}`); From 8c39f9ffd4acaa2b51f9247b0bc71b50fcfd2f97 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 16:38:38 -0700 Subject: [PATCH 08/12] Move test environment to separate code workspace --- .gitignore | 1 - examples/.vscode/settings.json | 4 ---- extension-dev.code-workspace | 1 + test/TestEnvironment.code-workspace | 13 +++++++++++++ test/features/DebugSession.test.ts | 2 ++ test/runTests.ts | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 test/TestEnvironment.code-workspace diff --git a/.gitignore b/.gitignore index b260098f5d..d83b12799f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ obj/ bin/ out/ sessions/ -test/**/.vscode test-results.xml *.vsix *.DS_Store diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json index fad6823648..a37044b519 100644 --- a/examples/.vscode/settings.json +++ b/examples/.vscode/settings.json @@ -3,8 +3,4 @@ // Relative paths for this setting are always relative to the workspace root dir. "powershell.scriptAnalysis.settingsPath": "./PSScriptAnalyzerSettings.psd1", "files.defaultLanguage": "powershell", - // Suppresses some first-run messages - "git.openRepositoryInParentFolders": "never", - "csharp.suppressDotnetRestoreNotification": true, - "extensions.ignoreRecommendations": true } diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace index 7fe06b5c56..df8e88a9ee 100644 --- a/extension-dev.code-workspace +++ b/extension-dev.code-workspace @@ -21,6 +21,7 @@ ] }, "settings": { + "window.title": "PowerShell VSCode Extension Development", "debug.onTaskErrors": "prompt", "editor.tabSize": 4, "editor.insertSpaces": true, diff --git a/test/TestEnvironment.code-workspace b/test/TestEnvironment.code-workspace new file mode 100644 index 0000000000..e472006fa0 --- /dev/null +++ b/test/TestEnvironment.code-workspace @@ -0,0 +1,13 @@ +{ + // A simple test environment that suppresses some first start warnings we dont care about. + "folders": [ + { + "path": "mocks" + } + ], + "settings": { + "git.openRepositoryInParentFolders": "never", + "csharp.suppressDotnetRestoreNotification": true, + "extensions.ignoreRecommendations": true + } +} diff --git a/test/features/DebugSession.test.ts b/test/features/DebugSession.test.ts index 9080fc1064..191eafa336 100644 --- a/test/features/DebugSession.test.ts +++ b/test/features/DebugSession.test.ts @@ -428,6 +428,8 @@ describe("DebugSessionFeature E2E", function slowTests() { afterEach(async () => { // Cleanup E2E testing state await debug.stopDebugging(undefined); + // Close all editors + await commands.executeCommand("workbench.action.closeAllEditors"); }); it("Debugs a binary module script", async () => { diff --git a/test/runTests.ts b/test/runTests.ts index 3bff3ddeac..9057ee2026 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -25,7 +25,7 @@ async function main(): Promise { const extensionTestsPath = path.resolve(__dirname, "./index"); /** The starting workspace/folder to open in vscode. */ - const workspacePath = process.env.__TEST_WORKSPACE_PATH ?? "test/mocks"; + const workspacePath = process.env.__TEST_WORKSPACE_PATH ?? "test/TestEnvironment.code-workspace"; const workspaceToOpen = path.resolve(extensionDevelopmentPath, workspacePath); /** The version to test. By default we test on insiders. */ From 520242a504c1db39b84a417c34c85d9cb745a144 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Tue, 11 Apr 2023 16:45:41 -0700 Subject: [PATCH 09/12] Move settings reference to workspace --- vscode-powershell.build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 859c1711f8..20e02f803c 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -113,7 +113,7 @@ task Test Build, { Write-Host "`n### Running extension tests" -ForegroundColor Green Invoke-BuildExec { & npm run test } # Reset the state of files modified by tests - Invoke-BuildExec { git checkout package.json test/.vscode/settings.json} + Invoke-BuildExec { git checkout package.json test/TestEnvironment.code-workspace } } task TestEditorServices -If (Get-EditorServicesPath) { From 90bb2f67599f793e36f2e3839aa29e0d57efc5cd Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Wed, 12 Apr 2023 11:14:06 -0700 Subject: [PATCH 10/12] Fix Extension Dev Name Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com> --- extension-dev.code-workspace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace index df8e88a9ee..40fbb1c67b 100644 --- a/extension-dev.code-workspace +++ b/extension-dev.code-workspace @@ -21,7 +21,7 @@ ] }, "settings": { - "window.title": "PowerShell VSCode Extension Development", + "window.title": "PowerShell VS Code Extension Development", "debug.onTaskErrors": "prompt", "editor.tabSize": 4, "editor.insertSpaces": true, From 9337d17333fa0804a2636cc93c755283790c8d4a Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Wed, 12 Apr 2023 11:14:33 -0700 Subject: [PATCH 11/12] Fix eslint casing Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com> --- extension-dev.code-workspace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension-dev.code-workspace b/extension-dev.code-workspace index 40fbb1c67b..2a552513f0 100644 --- a/extension-dev.code-workspace +++ b/extension-dev.code-workspace @@ -47,7 +47,7 @@ "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline", // Lock the TypeScript SDK path to the version we use "typescript.tsdk": "Client/node_modules/typescript/lib", - // Code actions like "organize imports" ignore eslint, so we need this here + // Code actions like "organize imports" ignore ESLint, so we need this here "typescript.format.semicolons": "insert", // Enable ESLint as defaut formatter so quick fixes can be applied directly "eslint.format.enable": true, From 7b6db91bd97c8b4201574c10eed35d8d3e5c8399 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Wed, 12 Apr 2023 11:17:39 -0700 Subject: [PATCH 12/12] Fix contraction typo Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com> --- test/TestEnvironment.code-workspace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestEnvironment.code-workspace b/test/TestEnvironment.code-workspace index e472006fa0..b4035e33c5 100644 --- a/test/TestEnvironment.code-workspace +++ b/test/TestEnvironment.code-workspace @@ -1,5 +1,5 @@ { - // A simple test environment that suppresses some first start warnings we dont care about. + // A simple test environment that suppresses some first start warnings we don't care about. "folders": [ { "path": "mocks"