From 6068537a5f6cd335d1a13ed15993a35e3b110d16 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Tue, 14 Nov 2017 11:42:11 -0700 Subject: [PATCH] Fix #1100 vscode.startDebug deprecated - can't use for Pester CodeLens (#1101) --- examples/Tests/PathProcessing.Tests.ps1 | 3 ++- src/features/PesterTests.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/Tests/PathProcessing.Tests.ps1 b/examples/Tests/PathProcessing.Tests.ps1 index 736fd61376..920c0aab56 100644 --- a/examples/Tests/PathProcessing.Tests.ps1 +++ b/examples/Tests/PathProcessing.Tests.ps1 @@ -12,7 +12,8 @@ $null = New-Item -Path "$PSScriptRoot\foo[1].txt" -Force Import-Module $PSScriptRoot\..\SampleModule.psd1 -$WorkspaceRoot = $pwd +$WorkspaceRoot = Convert-Path $PSScriptRoot/.. +Set-Location $WorkspaceRoot Describe 'Verify Path Processing for Non-existing Paths Allowed Impl' { It 'Processes non-wildcard absolute path to non-existing file via -Path param' { diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index 2f5463b571..d0d141d6dc 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -37,6 +37,7 @@ export class PesterTestsFeature implements IFeature { let launchConfig = { request: "launch", type: "PowerShell", + name: "PowerShell Launch Pester Tests", script: "Invoke-Pester", args: [ `-Script "${uri.fsPath}"`, @@ -61,6 +62,7 @@ export class PesterTestsFeature implements IFeature { utils.getDebugSessionFilePath(), this.sessionManager.getSessionDetails()); - vscode.commands.executeCommand('vscode.startDebug', launchConfig); + // TODO: Update to handle multiple root workspaces. + vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], launchConfig); } }