Skip to content

Commit

Permalink
test(test-bin): Only write output file in CI and fix trailing whitesp…
Browse files Browse the repository at this point in the history
…aces (#4613)
niheaven authored Dec 30, 2021
1 parent d5cb860 commit 5d8aeb5
Showing 4 changed files with 22 additions and 16 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,14 +6,18 @@
- **depends:** Prevent error on no URL ([#4595](https://github.com/ScoopInstaller/Scoop/issues/4595))
- **decompress:** Fix nested Zstd archive extraction ([#4608](https://github.com/ScoopInstaller/Scoop/issues/4608))

### Documentation

- **changelog:** Add 'CHANGLOG.md' ([#4600](https://github.com/ScoopInstaller/Scoop/issues/4600))

### Styles

- **test:** Format scripts by VSCode's PowerShell extension ([#4609](https://github.com/ScoopInstaller/Scoop/issues/4609))

### Tests

- **test-bin:** Only write output file in CI and fix trailing whitespaces ([#4613](https://github.com/ScoopInstaller/Scoop/issues/4613))

### Documentation

- **changelog:** Add 'CHANGLOG.md' ([#4600](https://github.com/ScoopInstaller/Scoop/issues/4600))

<a name="2021-12-26"></a>
## [2021-12-26]

6 changes: 3 additions & 3 deletions libexec/scoop-prefix.ps1
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# Summary: Returns the path to the specified app
param($app)

if(!$app) {
if (!$app) {
. "$psscriptroot\..\lib\help.ps1"
my_usage
exit 1
@@ -11,11 +11,11 @@ if(!$app) {
. "$psscriptroot\..\lib\core.ps1"

$app_path = versiondir $app 'current' $false
if(!(Test-Path $app_path)) {
if (!(Test-Path $app_path)) {
$app_path = versiondir $app 'current' $true
}

if(Test-Path $app_path) {
if (Test-Path $app_path) {
Write-Output $app_path
} else {
abort "Could not find app path for '$app'."
3 changes: 0 additions & 3 deletions schema.json
Original file line number Diff line number Diff line change
@@ -220,9 +220,6 @@
},
"persist": {
"$ref": "#/definitions/stringOrArrayOfStringsOrAnArrayOfArrayOfStrings"
},
"license": {
"$ref": "#/definitions/license"
},
"license": {
"$ref": "#/definitions/license"
17 changes: 11 additions & 6 deletions test/bin/test.ps1
Original file line number Diff line number Diff line change
@@ -6,17 +6,20 @@ param(
[String] $TestPath = 'test/'
)

$resultsXml = "$PSScriptRoot/TestResults.xml"
$excludes = @()

$splat = @{
Path = $TestPath
OutputFile = $resultsXml
OutputFormat = 'NUnitXML'
PassThru = $true
}

if ($env:CI -eq $true) {
$resultsXml = "$PSScriptRoot/TestResults.xml"
$excludes = @()

$splat += @{
OutputFile = $resultsXml
OutputFormat = 'NUnitXML'
}

$commit = if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
$commitMessage = "$env:APPVEYOR_REPO_COMMIT_MESSAGE $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED".TrimEnd()

@@ -62,7 +65,9 @@ if ($env:CI -eq $true) {
Write-Host 'Invoke-Pester' @splat
$result = Invoke-Pester @splat

(New-Object Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $resultsXml)
if ($env:CI -eq $true) {
(New-Object Net.WebClient).UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $resultsXml)
}

if ($result.FailedCount -gt 0) {
exit $result.FailedCount

0 comments on commit 5d8aeb5

Please sign in to comment.