Skip to content

Commit 22158d8

Browse files
try fix 1
1 parent 72be9ca commit 22158d8

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

integration-tests/run.ps1

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ function Compare-Files {
9191
Write-Host "Actual dir: $actualDir"
9292
Write-Host "Label: $label"
9393

94-
# Normalize paths to use the current OS's path separator
95-
$expectedDir = $expectedDir.Replace('/', [System.IO.Path]::DirectorySeparatorChar).Replace('\', [System.IO.Path]::DirectorySeparatorChar)
96-
$actualDir = $actualDir.Replace('/', [System.IO.Path]::DirectorySeparatorChar).Replace('\', [System.IO.Path]::DirectorySeparatorChar)
94+
# Convert to absolute paths and normalize separators
95+
$expectedDir = (Resolve-Path $expectedDir).Path
96+
$actualDir = (Resolve-Path $actualDir).Path
9797

98-
Write-Host "Normalized paths:"
99-
Write-Host "Expected dir (normalized): $expectedDir"
100-
Write-Host "Actual dir (normalized): $actualDir"
98+
Write-Host "Resolved paths:"
99+
Write-Host "Expected dir (resolved): $expectedDir"
100+
Write-Host "Actual dir (resolved): $actualDir"
101101

102102
# List directory contents before comparison
103103
Write-Host "`nExpected directory contents:"
@@ -112,13 +112,14 @@ function Compare-Files {
112112

113113
# Compare files
114114
Get-ChildItem -Path $expectedDir -File | ForEach-Object {
115-
$actualFile = Join-Path $actualDir $_.Name
116-
Write-Host "`nChecking file: $($_.Name)"
115+
$relativePath = $_.FullName.Replace($expectedDir, '').TrimStart('\')
116+
$actualFile = Join-Path $actualDir $relativePath
117+
Write-Host "`nChecking file: $relativePath"
117118
Write-Host "Expected file: $($_.FullName)"
118119
Write-Host "Actual file: $actualFile"
119120

120121
if (-not (Test-Path $actualFile)) {
121-
Write-Host "$label/$($_.Name) does not exist in actual output"
122+
Write-Host "$label/$relativePath does not exist in actual output"
122123
Write-Host "Expected: $($_.FullName)"
123124
Write-Host "Actual should be: $actualFile"
124125
Write-Host "Current directory structure:"
@@ -135,7 +136,7 @@ function Compare-Files {
135136
# Compare line by line
136137
$diff = Compare-Object $expectedContent $actualContent -PassThru
137138
if ($diff) {
138-
Write-Host "$label/$($_.Name) does not match expected"
139+
Write-Host "$label/$relativePath does not match expected"
139140
Write-Host "=== Expected (normalized) ==="
140141
$expectedContent
141142
Write-Host "=== Actual (normalized) ==="
@@ -145,18 +146,19 @@ function Compare-Files {
145146
Write-Host "==================="
146147
exit 1
147148
}
148-
Write-Host "$label/$($_.Name) matches expected"
149+
Write-Host "$label/$relativePath matches expected"
149150
}
150151

151152
# Compare subdirectories
152153
Get-ChildItem -Path $expectedDir -Directory | Where-Object { $_.Name -ne "logs" } | ForEach-Object {
153-
$actualSubDir = Join-Path $actualDir $_.Name
154-
Write-Host "`nChecking subdirectory: $($_.Name)"
154+
$relativePath = $_.FullName.Replace($expectedDir, '').TrimStart('\')
155+
$actualSubDir = Join-Path $actualDir $relativePath
156+
Write-Host "`nChecking subdirectory: $relativePath"
155157
Write-Host "Expected dir: $($_.FullName)"
156158
Write-Host "Actual dir: $actualSubDir"
157159

158160
if (-not (Test-Path $actualSubDir)) {
159-
Write-Host "❌ Directory $label/$($_.Name) does not exist in actual output"
161+
Write-Host "❌ Directory $label/$relativePath does not exist in actual output"
160162
Write-Host "Expected: $($_.FullName)"
161163
Write-Host "Actual should be: $actualSubDir"
162164
Write-Host "Current directory structure:"
@@ -165,7 +167,7 @@ function Compare-Files {
165167
}
166168
exit 1
167169
}
168-
Compare-Files $_.FullName $actualSubDir "$label/$($_.Name)"
170+
Compare-Files $_.FullName $actualSubDir "$label/$relativePath"
169171
}
170172

171173
Write-Host "`n=== Directory Comparison Complete ==="

0 commit comments

Comments
 (0)