Assert-ConsoleOutput
Compares console output with a golden file (for Pester and other tests).
Syntax
Assert-ConsoleOutput [-Culture <CultureInfo>] [-Glyphs <Ascii|Basic|Full>] [-GoldenPath] <String> [-Height <Int32>] [-InputObject] <Object> [-PassThru] [-Width <Int32>] [<CommonParameters>]#All Parameter SetsDescription
Compares console output with a golden file (for Pester and other tests).
Renders a widget at a fixed width, glyph tier and culture (invariant by default), so the result does not depend on the machine, and compares the text with a golden file. The first run writes the file and fails so it can be reviewed; a difference fails with the first differing line, both versions and the column where they part. Set CONSOLEMONSTER_UPDATE_GOLDEN=1 to rewrite golden files after an intended change. Strings are compared as they are. In Pester the thrown error fails the test; see the README for a Should operator built on it.
Examples
EXAMPLE 1
Assert-ConsoleOutput -InputObject 'Value' -GoldenPath 'C:\Path'Parameters
- -Culture CultureInfo
- The culture for numbers and dates (default: invariant).
- -Glyphs GlyphTier
- The glyph tier (default Full).
- Possible values:
Ascii,Basic,Full - -GoldenPath String
- The golden file.
- -Height Int32
- Height in cells (default: as tall as the widget measures).
- -InputObject Object
- A widget, or text to compare as it is.
- -PassThru SwitchParameter
- Writes the rendered text to the pipeline when it matches.
- -Width Int32
- Width in cells (default 80).
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.