Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/Get-CodeCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
####################################################################################

Param(
[string]$TestProjectFilter = 'Tests.*.csproj',
[string]$TestProjectFilter = '*.Specs.*.csproj',
[switch]$ProdPackagesOnly = $false,
[string[]]$ProductionAssemblies = @(
"Goodtocode.SemanticKernel.Core.Application",
Expand All @@ -34,21 +34,27 @@ $reportOutputPath = Join-Path $scriptPath "TestResults\Reports\$timestamp"
New-Item -ItemType Directory -Force -Path $coverageOutputPath
New-Item -ItemType Directory -Force -Path $reportOutputPath

# Find tests for projects with 'Tests.*.csproj'
$solutionFile = Get-ChildItem -Path $scriptPath -Filter *.sln -Recurse | Select-Object -First 1
if ($null -eq $solutionFile) {
Write-Host "No solution file found. Exiting."
exit 1
}
Write-Host "Building solution: $($solutionFile.FullName)"
dotnet build $solutionFile.FullName

$testProjects = Get-ChildItem $scriptPath -Filter $TestProjectFilter -Recurse
Write-Host "Found $($testProjects.Count) test projects."
foreach ($project in $testProjects) {
$testProjectPath = $project.FullName
Write-Host "Running tests for project: $($testProjectPath)"

dotnet test $testProjectPath --no-build
$buildOutput = Join-Path -Path $project.Directory.FullName -ChildPath "bin\Debug\net9.0\$($project.BaseName).dll"
$coverageFile = Join-Path $coverageOutputPath "coverage.cobertura.xml"
Write-Host "Analyzing code coverage for: $buildOutput"
coverlet $buildOutput --target "dotnet" --targetargs "test $($project.FullName) --no-build" --format cobertura --output $coverageFile

}

# Generate HTML report
if ($ProdPackagesOnly) {
$assemblyFilters = ($ProductionAssemblies | ForEach-Object { "+$_" }) -join ";"
$assemblyFilters = ($ProductionAssemblies | ForEach-Object { "+$_" }) -join ";"
Expand Down
4 changes: 1 addition & 3 deletions src/Presentation.WebApi/Generate-NswagClientCode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
param (
[string]$SwaggerJsonPath = 'swagger',
[string]$ApiAssembly = 'bin\Debug\net9.0\Goodtocode.SemanticKernel.Presentation.WebApi.dll',
[string]$ApiVersion = 'v1',
[string]$ClientPathFile = '../Presentation.Blazor/Clients/WebApiClient.g.cs',
[string]$ClientNamespace = 'Goodtocode.SemanticKernel.Presentation.WebApi.Client'
[string]$ApiVersion = 'v1'
)
####################################################################################
Set-ExecutionPolicy Unrestricted -Scope Process -Force
Expand Down
Loading