Skip to content

Commit 89ce67d

Browse files
Verify generated artifact paths directly
1 parent 5602645 commit 89ce67d

3 files changed

Lines changed: 4 additions & 35 deletions

File tree

.github/workflows/Action-Test.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,7 @@ jobs:
203203
204204
- name: Assert default artifact paths
205205
shell: pwsh
206-
env:
207-
TEST_RESULT_OUTPUT_PATH: ${{ steps.action-test.outputs.TestResultOutputPath }}
208-
CODE_COVERAGE_OUTPUT_PATH: ${{ steps.action-test.outputs.CodeCoverageOutputPath }}
209-
run: |
210-
tests/Assert-ArtifactPaths.ps1 `
211-
-Layout Default `
212-
-TestResultOutputPath $env:TEST_RESULT_OUTPUT_PATH `
213-
-CodeCoverageOutputPath $env:CODE_COVERAGE_OUTPUT_PATH
206+
run: tests/Assert-ArtifactPaths.ps1 -Layout Default
214207

215208
- name: Status
216209
shell: pwsh
@@ -239,14 +232,7 @@ jobs:
239232

240233
- name: Assert .PSModule artifact paths
241234
shell: pwsh
242-
env:
243-
TEST_RESULT_OUTPUT_PATH: ${{ steps.action-test.outputs.TestResultOutputPath }}
244-
CODE_COVERAGE_OUTPUT_PATH: ${{ steps.action-test.outputs.CodeCoverageOutputPath }}
245-
run: |
246-
tests/Assert-ArtifactPaths.ps1 `
247-
-Layout PSModule `
248-
-TestResultOutputPath $env:TEST_RESULT_OUTPUT_PATH `
249-
-CodeCoverageOutputPath $env:CODE_COVERAGE_OUTPUT_PATH
235+
run: tests/Assert-ArtifactPaths.ps1 -Layout PSModule
250236

251237
ActionTest2StandardPrescriptFile:
252238
name: Action-Test - [2-Standard-PrescriptFile]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ jobs:
264264
| **Input** | **Description** | **Default** |
265265
|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
266266
| `Path` | Path to where tests are located or a configuration file. | *(none)* |
267-
| `OutputDirectory` | Repository-relative directory for action-generated `TestResult`, `CodeCoverage`, and `.temp` files. | *(working directory)* |
267+
| `OutputDirectory` | Repository-relative directory for action-generated `TestResult`, `CodeCoverage`, and `.temp` files. | `''` |
268268
| `Version` | Version of Pester to install (NuGet range, e.g. `[6.0.0,7.0.0)` for any 6.x). Empty installs the latest version. | *(none)* |
269269
| `Prerelease` | Allow installing prerelease versions of Pester. | `false` |
270270
| `Guid` | Optional module identity (GUID) the installed Pester must match; fails fast if a different module named Pester is loaded. Mirrors the GUID key of a `#Requires -Modules` pin. | *(none)* |

tests/Assert-ArtifactPaths.ps1

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
param(
33
[Parameter(Mandatory)]
44
[ValidateSet('Default', 'PSModule')]
5-
[string] $Layout,
6-
7-
[Parameter(Mandatory)]
8-
[string] $TestResultOutputPath,
9-
10-
[Parameter(Mandatory)]
11-
[string] $CodeCoverageOutputPath
5+
[string] $Layout
126
)
137

148
$outputDirectory = switch ($Layout) {
@@ -28,17 +22,6 @@ $expectedPaths = @{
2822
'test result JSON report' = Join-Path -Path $outputDirectory -ChildPath 'TestResult/Standard-TestResult-Report.json'
2923
}
3024

31-
$expectedTestResultOutputPath = Join-Path -Path $outputDirectory -ChildPath 'TestResult'
32-
$expectedCodeCoverageOutputPath = Join-Path -Path $outputDirectory -ChildPath 'CodeCoverage'
33-
34-
if ($TestResultOutputPath -ne $expectedTestResultOutputPath) {
35-
throw "Expected TestResultOutputPath [$expectedTestResultOutputPath], but received [$TestResultOutputPath]."
36-
}
37-
38-
if ($CodeCoverageOutputPath -ne $expectedCodeCoverageOutputPath) {
39-
throw "Expected CodeCoverageOutputPath [$expectedCodeCoverageOutputPath], but received [$CodeCoverageOutputPath]."
40-
}
41-
4225
foreach ($artifact in $expectedPaths.GetEnumerator()) {
4326
if (-not (Test-Path -Path $artifact.Value -PathType Leaf)) {
4427
throw "Expected $($artifact.Key) at [$($artifact.Value)]."

0 commit comments

Comments
 (0)