Skip to content

Commit 707febd

Browse files
authored
Add additional debug configs (#4511)
1 parent c990d7f commit 707febd

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

src/features/DebugSession.ts

+55-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export enum DebugConfig {
4545
LaunchScript,
4646
InteractiveSession,
4747
AttachHostProcess,
48+
RunPester,
49+
ModuleInteractiveSession,
50+
BinaryModule,
51+
BinaryModulePester,
4852
}
4953

5054
/** Make the implicit behavior of undefined and null in the debug api more explicit */
@@ -55,7 +59,7 @@ type ResolveDebugConfigurationResult = DebugConfiguration | PREVENT_DEBUG_START
5559
const PREVENT_DEBUG_START = undefined;
5660
const PREVENT_DEBUG_START_AND_OPEN_DEBUGCONFIG = null;
5761

58-
62+
/** Represents the various built-in debug configurations that will be advertised to the user if they choose "Add Config" from the launch debug config window */
5963
export const defaultDebugConfigurations: Record<DebugConfig, DebugConfiguration> = {
6064
[DebugConfig.LaunchCurrentFile]: {
6165
name: "PowerShell: Launch Current File",
@@ -81,6 +85,36 @@ export const defaultDebugConfigurations: Record<DebugConfig, DebugConfiguration>
8185
type: "PowerShell",
8286
request: "attach",
8387
runspaceId: 1,
88+
},
89+
[DebugConfig.RunPester]: {
90+
name: "PowerShell: Run Pester Tests",
91+
type: "PowerShell",
92+
request: "launch",
93+
script: "Invoke-Pester",
94+
createTemporaryIntegratedConsole: true,
95+
attachDotnetDebugger: true
96+
},
97+
[DebugConfig.ModuleInteractiveSession]: {
98+
name: "PowerShell: Module Interactive Session",
99+
type: "PowerShell",
100+
request: "launch",
101+
script: "Enter command to import your binary module, for example: \"Import-Module -Force ${workspaceFolder}/path/to/module.psd1|dll\"",
102+
},
103+
[DebugConfig.BinaryModule]: {
104+
name: "PowerShell: Binary Module Interactive",
105+
type: "PowerShell",
106+
request: "launch",
107+
script: "Enter command to import your binary module, for example: \"Import-Module -Force ${workspaceFolder}/path/to/module.psd1|dll\"",
108+
createTemporaryIntegratedConsole: true,
109+
attachDotnetDebugger: true
110+
},
111+
[DebugConfig.BinaryModulePester]: {
112+
name: "PowerShell: Binary Module Pester Tests",
113+
type: "PowerShell",
114+
request: "launch",
115+
script: "Invoke-Pester",
116+
createTemporaryIntegratedConsole: true,
117+
attachDotnetDebugger: true
84118
}
85119
};
86120

@@ -147,6 +181,26 @@ export class DebugSessionFeature extends LanguageClientConsumer
147181
label: "Attach",
148182
description: "Attach the debugger to a running PowerShell Host Process",
149183
},
184+
{
185+
id: DebugConfig.RunPester,
186+
label: "Run Pester Tests",
187+
description: "Debug Pester Tests detected in your current directory (runs Invoke-Pester)",
188+
},
189+
{
190+
id: DebugConfig.ModuleInteractiveSession,
191+
label: "Interactive Session (Module)",
192+
description: "Debug commands executed from the PowerShell Extension Terminal after auto-loading your module",
193+
},
194+
{
195+
id: DebugConfig.BinaryModule,
196+
label: "Interactive Session (Binary Module)",
197+
description: "Debug a .NET binary or hybrid module loaded into a PowerShell session. Breakpoints you set in your .NET (C#/F#/VB/etc.) code will be hit upon command execution. You may want to add a compile or watch action as a pre-launch task to this configuration.",
198+
},
199+
{
200+
id: DebugConfig.RunPester,
201+
label: "Run Pester Tests (Binary Module)",
202+
description: "Debug a .NET binary or hybrid module by running pester tests. Breakpoints you set in your .NET (C#/F#/VB/etc.) code will be hit upon command execution. You may want to add a compile or watch action as a pre-launch task to this configuration.",
203+
},
150204
];
151205

152206
const launchSelection =

0 commit comments

Comments
 (0)