From 5d8aeb54bb1a37df7a8bbd8ca9e032a86190f9da Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Fri, 31 Dec 2021 02:14:53 +0800 Subject: [PATCH] test(test-bin): Only write output file in CI and fix trailing whitespaces (#4613) --- CHANGELOG.md | 12 ++++++++---- libexec/scoop-prefix.ps1 | 6 +++--- schema.json | 3 --- test/bin/test.ps1 | 17 +++++++++++------ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cc42c222..035f3d9e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) + ## [2021-12-26] diff --git a/libexec/scoop-prefix.ps1 b/libexec/scoop-prefix.ps1 index 82436f307..0a140a379 100644 --- a/libexec/scoop-prefix.ps1 +++ b/libexec/scoop-prefix.ps1 @@ -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'." diff --git a/schema.json b/schema.json index 47b0e36d2..a5ece2c1e 100644 --- a/schema.json +++ b/schema.json @@ -220,9 +220,6 @@ }, "persist": { "$ref": "#/definitions/stringOrArrayOfStringsOrAnArrayOfArrayOfStrings" - }, - "license": { - "$ref": "#/definitions/license" }, "license": { "$ref": "#/definitions/license" diff --git a/test/bin/test.ps1 b/test/bin/test.ps1 index ec0662e57..d700b0dca 100644 --- a/test/bin/test.ps1 +++ b/test/bin/test.ps1 @@ -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