Skip to content
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

Created object first, then updated settings. #39

Merged
merged 2 commits into from
Jun 27, 2020
Merged
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
34 changes: 15 additions & 19 deletions Extension/PesterTask/PesterV10/Pester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,18 @@ if ($PSBoundParameters.ContainsKey('additionalModulePath')) {
Write-Host "Adding additional module path [$additionalModulePath] to `$env:PSModulePath"
$env:PSModulePath = $additionalModulePath + ';' + $env:PSModulePath
}
$PesterConfig = [PesterConfiguration]::Default

$PesterConfig = @{

Run = @{
Path = $TestFolder
PassThru = $true
}
TestResult = @{
Enabled = $true
OutputFormat = 'NUnit2.5'
OutputPath = $resultsFile
}
$PesterConfig.run = @{
Path = $TestFolder
PassThru = $true
}
$PesterConfig.TestResult = @{
Enabled = $true
OutputFormat = 'NUnit2.5'
OutputPath = $resultsFile
}


$Filter = @{}
if ($Tag) {
Expand All @@ -110,12 +109,11 @@ if ($ExcludeTag) {
$Filter.Add('ExcludeTag', $ExcludeTag)
}

$PesterConfig['Filter'] = $Filter
$PesterConfig.Filter = $Filter

$CodeCoverage = @{}
if ($CodeCoverageOutputFile) {
$CodeCoverage['Enabled'] = $True
$CodeCoverage['OutputFormat'] = "JaCoCo"
$PesterConfig.CodeCoverage.Enabled = $True
$PesterConfig.CodeCoverage.OutputFormat = "JaCoCo"

if (-not $PSBoundParameters.ContainsKey('CodeCoverageFolder')) {
$CodeCoverageFolder = $TestFolder
Expand All @@ -124,16 +122,14 @@ if ($CodeCoverageOutputFile) {
Select-object -ExpandProperty Fullname

if ($Files) {
$CodeCoverage.Add('Path', $Files)
$CodeCoverage.Add('OutputPath', $CodeCoverageOutputFile)
$PesterConfig.CodeCoverage.Path = $Files
$PesterConfig.CodeCoverage.OutputPath = $CodeCoverageOutputFile
}
else {
Write-Warning -Message "No PowerShell files found under [$CodeCoverageFolder] to analyse for code coverage."
}
}

$PesterConfig['CodeCoverage'] = $CodeCoverage

if (-not([String]::IsNullOrWhiteSpace($ScriptBlock))) {
$ScriptBlockObject = [ScriptBlock]::Create($ScriptBlock)

Expand Down