Skip to content

Add debug output option for Pester #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,11 +775,22 @@
"type": "string",
"enum": [
"FromPreference",
"Minimal",
"Normal",
"Minimal"
"Diagnostic"
],
"default": "FromPreference",
"description": "Defines the verbosity of output to be used. For Pester 5 and newer the default value FromPreference, will use the Output settings from the $PesterPreference defined in the caller context, and will default to Normal if there is none. For Pester 4 the FromPreference and Normal options map to All, and Minimal option maps to Fails."
},
"powershell.pester.debugOutputVerbosity": {
"type": "string",
"enum": [
"Minimal",
"Normal",
"Diagnostic"
],
"default": "Diagnostic",
"description": "Defines the verbosity of output to be used when debugging a test or a block. For Pester 5 and newer the default value Diagnostic will print additional information about discovery, skipped and filtered tests, mocking and more."
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/features/PesterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ export class PesterTestsFeature implements IFeature {
launchConfig.args.push("-MinimumVersion5");
}

launchConfig.args.push("-Output", `'${settings.pester.outputVerbosity}'`);
if (launchType === LaunchType.Debug) {
launchConfig.args.push("-Output", `'${settings.pester.debugOutputVerbosity}'`);
}
else {
launchConfig.args.push("-Output", `'${settings.pester.outputVerbosity}'`);
}

return launchConfig;
}
Expand Down
2 changes: 2 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export interface ISideBarSettings {
export interface IPesterSettings {
useLegacyCodeLens?: boolean;
outputVerbosity?: string;
debugOutputVerbosity?: string;
}

export function load(): ISettings {
Expand Down Expand Up @@ -189,6 +190,7 @@ export function load(): ISettings {
const defaultPesterSettings: IPesterSettings = {
useLegacyCodeLens: true,
outputVerbosity: "FromPreference",
debugOutputVerbosity: "Diagnostic",
};

return {
Expand Down