|
77 | 77 | shell: pwsh |
78 | 78 | run: | |
79 | 79 | cd ${{ github.workspace }} |
80 | | -
|
81 | | - # Set up environment |
82 | | - $testRoot = Join-Path $PWD.Path "test/unit-tests" |
83 | | - $env:PSModulePath = "$testRoot;" + $env:PSModulePath |
84 | | -
|
85 | | - # Import test framework |
86 | | - $frameworkPath = Join-Path $testRoot "test_framework.ps1" |
87 | | - . $frameworkPath |
88 | | -
|
89 | | - # Import all test functions |
90 | | - $functionsPath = Join-Path $testRoot "test_functions" |
91 | | - Get-ChildItem $functionsPath -Filter "*.ps1" | ForEach-Object { |
92 | | - Write-Host "Importing function: $($_.FullName)" |
93 | | - . $_.FullName |
94 | | - } |
95 | | -
|
96 | | - # Get list of available test functions |
97 | | - $availableFunctions = (Get-ChildItem $functionsPath -Filter "*.ps1").BaseName |
98 | | - Write-Host "Available test functions: $($availableFunctions -join ', ')" |
99 | | -
|
100 | | - # Find corresponding test files that have matching functions |
101 | | - $testCasesPath = Join-Path $testRoot "test_cases" |
102 | | - $validTestFiles = Get-ChildItem $testCasesPath -Filter "*.ps1" | Where-Object { |
103 | | - $testName = $_.BaseName -replace "^Test-" |
104 | | - $testName -in $availableFunctions -or |
105 | | - $availableFunctions -contains "Get-$testName" -or |
106 | | - $availableFunctions -contains "Is-$testName" |
107 | | - } |
108 | | - Write-Host "Valid test files to run: $($validTestFiles.BaseName -join ', ')" |
109 | | -
|
110 | | - # Configure Pester |
111 | | - $config = New-PesterConfiguration |
112 | | - $config.Run.Path = $validTestFiles.FullName |
113 | | - $config.Output.Verbosity = "Detailed" |
114 | | - $config.Run.PassThru = $true |
115 | | - $config.TestResult.Enabled = $true |
116 | | - $config.TestResult.OutputFormat = "NUnitXml" |
117 | | - $config.TestResult.OutputPath = "test-results.xml" |
118 | | - # Run all test files in test_cases directory |
119 | | - $result = Invoke-Pester -Configuration $config |
120 | | -
|
121 | | - # Handle test results |
122 | | - if ($result.Failed.Count -gt 0) { |
123 | | - Write-Host "Tests failed: $($result.Failed.Count) of $($result.Total) tests failed" |
124 | | - exit 1 |
125 | | - } else { |
126 | | - Write-Host "All tests passed: $($result.Passed.Count) tests" |
127 | | - } |
| 80 | + ./test/unit-tests/test_main.ps1 |
0 commit comments