Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c53d022
Add some other helpful VS Code settings
fourpastmidnight Mar 26, 2019
a060a1a
Rename Gherkin.ps1 to Gherkin.Core.ps1
fourpastmidnight Mar 26, 2019
96991fb
Add new Gherkin.Output.ps1 file
fourpastmidnight Mar 26, 2019
51188c3
Clean up Import-GherkinFeature
fourpastmidnight Mar 26, 2019
1bdfacb
Put report strings and theme in Gherkin.psd1
fourpastmidnight Mar 26, 2019
e06e726
Replace all "-strings w/ '-strings in $SafeCommands
fourpastmidnight Mar 26, 2019
857b3ad
Process exclude tags for features earlier
fourpastmidnight Mar 28, 2019
432dabf
Don't Convert-Tags on Backgrounds
fourpastmidnight Mar 28, 2019
606b7c7
Adds NoMultiline parameter to Invoke-GherkinStep
fourpastmidnight Mar 28, 2019
e32788f
Invoke-GherkinStep improvements
fourpastmidnight Mar 28, 2019
ad99dd4
Exchange "-strings for '-strings
fourpastmidnight Mar 31, 2019
867ce78
Show step DocStrings and DataTables in console
fourpastmidnight Apr 2, 2019
ee7cbec
Complete support for NoMultiline and Expand
fourpastmidnight Apr 3, 2019
800addb
Improve Gherkin PesterState, more cleanup
fourpastmidnight Apr 3, 2019
1cc56a5
Fixes PSv2 PSObject Unwrapping, PSv6 Group-Object Sorting
fourpastmidnight Apr 4, 2019
9e516f6
Process scenario outlines similarly to Ruby Cucumber
fourpastmidnight Apr 5, 2019
e731032
Extract method to get DataTable max column widths
fourpastmidnight Apr 6, 2019
b28fc24
Adds support for unexpanded scenarios
fourpastmidnight Apr 6, 2019
5702460
Improves Gherkin console test run output
fourpastmidnight Apr 6, 2019
e69df79
Adds Write-GherkinReport
fourpastmidnight Apr 8, 2019
4c22d45
Return a feature w/ its background and scenarios
fourpastmidnight Nov 18, 2019
cd445ec
Rework stack trace printing
fourpastmidnight Nov 24, 2019
fbb9607
Update StackTrace printing to work with PSv2
fourpastmidnight Nov 27, 2019
abf4c22
Fix test report output for single scenario/step results
fourpastmidnight Apr 1, 2020
8cc71b3
Fixes Invoke-GherkinHook break jump label target
fourpastmidnight Apr 7, 2020
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
60 changes: 60 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": "${workspaceRoot}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Debug Tests w/Args Prompt",
"script": "Import-Module '${workspaceRoot}\\Pester.psd1'; Invoke-Pester",
"args": [
"-PesterOption @{ IncludeVSCodeMarker = $True }",
"${command:SpecifyScriptArgs}"
],
"cwd": "${workspaceRoot}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Debug Current Test File w/Args Prompt",
"script": "Import-Module '${workspaceRoot}\\Pester.psd1'; Invoke-Pester -Path '${file}'",
"args": [
"-PesterOption @{ IncludeVSCodeMarker = $True }",
"${command:SpecifyScriptArgs}"
],
"cwd": "${workspaceRoot}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Debug Gherkin Test Runner using Current Feature File w/Args Prompt",
"script": "Import-Module '${workspaceRoot}\\Pester.psd1'; Invoke-Gherkin -Path '${file}'",
"args": [
"-PesterOption @{ IncludeVSCodeMarker = $True }",
"${command:SpecifyScriptArgs}"
],
"cwd": "${workspaceRoot}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Debug Gherkin Test Runner w/Args Prompt",
"script": "Import-Module '${workspaceRoot}\\Pester.psd1'; Invoke-Gherkin",
"args": [
"-PesterOption @{ IncludeVSCodeMarker = $True }",
"${command:SpecifyScriptArgs}"
],
"cwd": "${workspaceRoot}",
"createTemporaryIntegratedConsole": true
},
]
}
19 changes: 18 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"powershell.codeFormatting.preset": "Stroustrup",

"files.associations": {
"*.ps1xml": "xml"
},
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,

"editor.tabSize": 4,
"editor.formatOnSave": true
"editor.formatOnSave": true,
"[feature]": {
"editor.quickSuggestions": {
"comments": false,
"strings": true,
"other": true
},
"editor.renderWhitespace": "all",
"editor.rulers": [110],
"editor.tabSize": 2
},
"[powershell]": {
"editor.rulers": [110],
"files.encoding": "utf8bom"
}
}
171 changes: 171 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${relativeFile}: the current opened file relative to workspaceRoot
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",

// Start PowerShell
"windows": {
"options": {
"shell": {
"executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-Command"
]
}
}
},
"linux": {
"options": {
"shell": {
"executable": "/usr/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},
"osx": {
"options": {
"shell": {
"executable": "/usr/local/bin/pwsh",
"args": [
"-NoProfile",
"-Command"
]
}
}
},

// Associate with test task runner
"tasks": [
{
"label": "Run All Tests (PowerShell Desktop)",
"group": "test",
"type": "shell",
"command": "$ErrorActionPreference = 'Stop'; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run All Tests (PowerShell v2 Desktop)",
"group": "test",
"type": "shell",
"command": "& C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -Version 2.0 -NoProfile -ExecutionPolicy Bypass -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run All Tests (PowerShell Core)",
"group": "test",
"type": "shell",
"command": "& '${env:ProgramFiles}\\PowerShell\\6\\pwsh.exe' -NoProfile -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run RSpec Pester Tests (PowerShell Desktop)",
"group": "test",
"type": "shell",
"command": "$ErrorActionPreference = 'Stop'; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help, Gherkin",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run RSpec Pester Tests (PowerShell v2 Desktop)",
"group": "test",
"type": "shell",
"command": "& C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -Version 2.0 -NoProfile -ExecutionPolicy Bypass -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help, Gherkin'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run RSpec Pester Tests (PowerShell Core)",
"group": "test",
"type": "shell",
"command": "& '${env:ProgramFiles}\\PowerShell\\6\\pwsh.exe' -NoProfile -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help, Gherkin'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run Gherkin Pester Tests (PowerShell Desktop)",
"group": "test",
"type": "shell",
"command": "$ErrorActionPreference = 'Stop'; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help -Tag Gherkin",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run Gherkin Pester Tests (PowerShell v2 Desktop)",
"group": "test",
"type": "shell",
"command": "& C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -Version 2.0 -NoProfile -ExecutionPolicy Bypass -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true ; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help -Tag Gherkin'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
},
{
"label": "Run Gherkin Pester Tests (PowerShell Core)",
"group": "test",
"type": "shell",
"command": "& '${env:ProgramFiles}\\PowerShell\\6\\pwsh.exe' -NoProfile -Command '$ErrorActionPreference = ''Stop''; $global:PesterDebugPreference_ShowFullErrors = $true; $PSVersionTable; Set-StrictMode -Version Latest; Import-Module .\\Pester.psd1; Invoke-Pester -ExcludeTag VersionChecks, StyleRules, Help -Tag Gherkin'",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$pester"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Feature: PesterResult shows executed feature names
# The following example fails in the Given code block
| FailedEarly | FailedEarlyScenarios |

Examples: Failing Scenario (inconclusive)
Examples: Undefined Scenario (inconclusive)
| Outcome | Status |
# In PesterResult.Steps.ps1 we do not implement anything for the following example
# to produce an inconclusive test result
| Does not matter | Does not matter |
| Undefined | UndefinedScenarios |

Examples: Pending Scenario
| Outcome | Status |
| Pending | PendingScenarios |
7 changes: 7 additions & 0 deletions Examples/Gherkin/JustForReporting.Steps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ When "step_402" {
Then "step_403" {
}

Given 'step_501' {
throw 'An example error in the given clause'
}

When 'step_502' {
}

Given "step_701" {
throw "An example error in the given clause"
}
Expand Down
11 changes: 7 additions & 4 deletions Examples/Gherkin/PesterResult.Steps.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Given "this feature and scenario" { }
When "(it|the scenario) is executed" { }
When "(?n)(it|the scenario) is executed" { }
Then "the feature name is displayed in the test report" { }

Given "this is a '(?<Outcome>(Passed|Failed(?:Early|Later)))' scenario" {
Given "this is a '(?<Outcome>(Passed|Pending|Failed(?:Early|Later)))' scenario" {
param($Outcome)
if ($Outcome -eq 'FailedEarly') {
if ($Outcome -match 'FailedEarly') {
throw "We fail for test by intention in the Given code block"
}
elseif ($Outcome -eq 'Pending') {
Set-StepPending
}
}

Then "the scenario name is displayed in the '(?<Status>(Passed|Failed(?:Early|Later))Scenarios)' array of the PesterResults object" {
Then "(?n)the scenario name is displayed in the '(?<Status>(Passed|Pending|Failed(Early|Later))Scenarios)' array of the PesterResults object" {
param($Status)

# Forcing a failure on FailedScenarios to ensure that the FailedScenarios array
Expand Down
Loading