-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathGherkin-step.yml
More file actions
75 lines (65 loc) · 2.82 KB
/
Gherkin-step.yml
File metadata and controls
75 lines (65 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
parameters:
specDirectory: '$(Build.SourcesDirectory)/Specs'
includeTag: []
excludeTag: []
additionalModulePaths: []
codeCoverageDirectory: ''
testRunTitle: 'Gherkin'
show: 'All'
steps:
- powershell: |
Import-Module Pester -Passthru
$Options = @{
Path = Convert-Path "${{ parameters.specDirectory }}"
OutputFormat = "NUnitXml"
OutputFile = Join-Path '$(Common.TestResultsDirectory)' 'Test-$(Build.SourceVersion).xml'
Show = "${{ parameters.show }}"
}
if ($CodeCoverage = "${{ parameters.codeCoverageDirectory }}") {
$Options.CodeCoverage = Get-ChildItem $CodeCoverage -Recurse -Include *.psm1, *.ps1 | Convert-Path
# I really need to get the Gherkin CodeCoverage Output fixed
# $Options.CodeCoverageOutputFile = '$(Common.TestResultsDirectory)/Coverage-$(Build.SourceVersion).xml'
}
if ($IncludeTag = @("${{ join('", "', parameters.includeTag) }}")) {
Write-Verbose "IncludeTag $($IncludeTag -join ', ')" -Verbose
$Options.Tag = $IncludeTag
}
if ($ExcludeTag = @("${{ join('", "', parameters.excludeTag) }}")) {
Write-Verbose "ExcludeTag $($ExcludeTag -join ', ')" -Verbose
$Options.ExcludeTag = $ExcludeTag
}
if ($AdditionalModulePaths = @("${{ join('", "', parameters.additionalModulePaths) }}")) {
$Env:PSModulePath = @(
@($AdditionalModulePaths -split [IO.Path]::PathSeparator | % TrimEnd(':;')) +
@($Env:PSModulePath -split [IO.Path]::PathSeparator | % TrimEnd(':;'))
) -join [IO.Path]::PathSeparator
Write-Verbose "PSModulePath $Env:PSModulePath" -Verbose
}
Write-Host $($Options | Out-String)
if (!$PSVersionTable.OS) {
$PSVersionTable.OS = [System.Environment]::OSVersion
}
Write-Host "##vso[task.setvariable variable=PSPlatform]PowerShell $($PSVersionTable['PSVersion','OS'] -join ' on ')"
Invoke-Gherkin @Options
displayName: Invoke-Gherkin
# - task: PublishCodeCoverageResults@1
# displayName: Publish Code Coverage
# inputs:
# summaryFileLocation: '$(Common.TestResultsDirectory)/Coverage-$(Build.SourceVersion).xml'
# pathToSources: ${{ parameters.codeCoverageDirectory }}
# failIfCoverageEmpty: true
# condition: |
# and(
# succeededOrFailed(),
# ne('', '${{ parameters.codeCoverageDirectory }}')
# )
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: NUnit
testResultsFiles: '$(Common.TestResultsDirectory)/Test-$(Build.SourceVersion).xml'
buildPlatform: $(PSPlatform)
buildConfiguration: ${{ parameters.configurationName }}
failTaskOnFailedTests: true
testRunTitle: "${{ parameters.testRunTitle }} on $(PSPlatform)"
condition: succeededOrFailed()