Skip to content

Commit

Permalink
Added option to pass in the configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbos committed Oct 7, 2019
1 parent 1a33fde commit 070faf9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions Run Stryker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,16 @@ function JoinAllJsonFiles ($joinedFileName) {
Write-Host "Joined $($files.Count) files to the new json file: $joinedFileName"
}

function LoadConfigurationFile ($startDir) {
# test for testdata first
$strykerDataFilePath = "$startDir\Stryker.TestData.json"
function LoadConfigurationFile ($startDir, $configurationFile) {
# try to load given file
$strykerDataFilePath = $configurationFile
if (!(Test-Path $strykerDataFilePath -PathType Leaf)) {
# if no testdata, use the data file
$strykerDataFilePath = "$startDir\Stryker.data.json"
# test for testdata first
$strykerDataFilePath = "$startDir\Stryker.TestData.json"
if (!(Test-Path $strykerDataFilePath -PathType Leaf)) {
# if no testdata, use the data file
$strykerDataFilePath = "$startDir\Stryker.data.json"
}
}

Write-Host "Using configuration file at '$strykerDataFilePath'"
Expand Down Expand Up @@ -141,9 +145,9 @@ function CreateReportFromAllJsonFiles ($reportDir, $startDir) {
Write-Host "Created new report file: $reportDir\$reportFileName"
}

function RunEverything ($startDir) {
function RunEverything ($startDir, $configurationFile) {
try {
$strykerData = LoadConfigurationFile $startDir
$strykerData = LoadConfigurationFile $startDir $configurationFile

# check for errors
if( -not $?) {
Expand Down
2 changes: 1 addition & 1 deletion RunAllSteps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
$startDir = Get-Location
Write-Host "Starting at: " $startDir

RunEverything $startDir
RunEverything $startDir $startDir

0 comments on commit 070faf9

Please sign in to comment.