@@ -84,12 +84,11 @@ function Run-Test {
8484 $startMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
8585
8686 # Run command, capture stdout to file, stderr to temp file
87- $proc = Start-Process - FilePath $CmdArgs [0 ] `
88- - ArgumentList ($CmdArgs [1 .. ($CmdArgs.Count - 1 )]) `
89- - RedirectStandardOutput $OutFile `
90- - RedirectStandardError $stderrFile `
91- - NoNewWindow - Wait - PassThru
92- $exitCode = $proc.ExitCode
87+ $exe = $CmdArgs [0 ]
88+ $args = @ ()
89+ if ($CmdArgs.Count -gt 1 ) { $args = $CmdArgs [1 .. ($CmdArgs.Count - 1 )] }
90+ & $exe @args > $OutFile 2> $stderrFile
91+ $exitCode = $LASTEXITCODE
9392
9493 $endMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
9594 $durationMs = $endMs - $startMs
@@ -167,12 +166,11 @@ function Run-Test-ExpectFail {
167166 $stderrFile = " $OUT_DIR \.stderr_tmp"
168167 $startMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
169168
170- $proc = Start-Process - FilePath $CmdArgs [0 ] `
171- - ArgumentList ($CmdArgs [1 .. ($CmdArgs.Count - 1 )]) `
172- - RedirectStandardOutput $OutFile `
173- - RedirectStandardError $stderrFile `
174- - NoNewWindow - Wait - PassThru
175- $exitCode = $proc.ExitCode
169+ $exe = $CmdArgs [0 ]
170+ $args = @ ()
171+ if ($CmdArgs.Count -gt 1 ) { $args = $CmdArgs [1 .. ($CmdArgs.Count - 1 )] }
172+ & $exe @args > $OutFile 2> $stderrFile
173+ $exitCode = $LASTEXITCODE
176174
177175 $endMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
178176 $durationMs = $endMs - $startMs
@@ -222,11 +220,11 @@ function Run-Crawl-Test {
222220 $startMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
223221
224222 # Crawl writes to outdir directly — discard stdout
225- $proc = Start-Process - FilePath $CmdArgs [0 ] `
226- - ArgumentList ( $CmdArgs [ 1 .. ( $CmdArgs .Count - 1 )]) `
227- - RedirectStandardError $stderrFile `
228- - NoNewWindow - Wait - PassThru
229- $exitCode = $proc .ExitCode
223+ $exe = $CmdArgs [0 ]
224+ $args = @ ()
225+ if ( $CmdArgs .Count -gt 1 ) { $args = $CmdArgs [ 1 .. ( $CmdArgs .Count - 1 )] }
226+ & $exe @args > $null 2> $stderrFile
227+ $exitCode = $LASTEXITCODE
230228
231229 $endMs = [long ]([datetime ]::UtcNow - [datetime ]::new(1970 , 1 , 1 )).TotalMilliseconds
232230 $durationMs = $endMs - $startMs
@@ -286,7 +284,7 @@ Run-Test "go/effective-go" "$OUT_DIR\tier1\effective-go.md" @($RAWDOC,
286284Run- Test " spring.io/blog" " $OUT_DIR \tier1\spring-blog.md" @ ($RAWDOC , " https://spring.io/blog" , " -v" )
287285Run- Test " mdn/http-status" " $OUT_DIR \tier1\mdn-http-status.md" @ ($RAWDOC , " https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" , " -v" )
288286Run- Test " postgresql/select" " $OUT_DIR \tier1\pg-select.md" @ ($RAWDOC , " https://www.postgresql.org/docs/current/sql-select.html" , " -v" )
289- Run- Test " istio/traffic-mgmt"" $OUT_DIR \tier1\istio-traffic.md" @ ($RAWDOC , " https://istio.io/latest/docs/concepts/traffic-management/" , " -v" )
287+ Run- Test " istio/traffic-mgmt" " $OUT_DIR \tier1\istio-traffic.md" @ ($RAWDOC , " https://istio.io/latest/docs/concepts/traffic-management/" , " -v" )
290288Run- Test " helm/chart-templates" " $OUT_DIR \tier1\helm-templates.md" @ ($RAWDOC , " https://helm.sh/docs/chart_template_guide/" , " -v" )
291289Run- Test " python/asyncio" " $OUT_DIR \tier1\python-asyncio.md" @ ($RAWDOC , " https://docs.python.org/3/library/asyncio.html" , " -v" )
292290Run- Test " gobyexample/goroutines" " $OUT_DIR \tier1\gobyexample-goroutines.md" @ ($RAWDOC , " https://gobyexample.com/goroutines" , " -v" )
@@ -346,7 +344,7 @@ Run-Crawl-Test "crawl/baeldung-spring (depth=1, max=5)" "$OUT_DIR\crawl\baeldung
346344Section " FAILURE HANDLING — expected failures"
347345
348346Run- Test-ExpectFail " fail/invalid-url" " $OUT_DIR \failures\invalid-url.md" @ ($RAWDOC , " not-a-valid-url" )
349- Run- Test-ExpectFail " fail/nonexistent-domain"" $OUT_DIR \failures\nonexistent.md" @ ($RAWDOC , " https://this-domain-does-not-exist-xyz123.com/page" )
347+ Run- Test-ExpectFail " fail/nonexistent-domain" " $OUT_DIR \failures\nonexistent.md" @ ($RAWDOC , " https://this-domain-does-not-exist-xyz123.com/page" )
350348Run- Test-ExpectFail " fail/http-403" " $OUT_DIR \failures\http-403.md" @ ($RAWDOC , " https://httpstat.us/403" , " -v" )
351349Run- Test-ExpectFail " fail/http-500" " $OUT_DIR \failures\http-500.md" @ ($RAWDOC , " https://httpstat.us/500" , " -v" )
352350Run- Test-ExpectFail " fail/http-429" " $OUT_DIR \failures\http-429.md" @ ($RAWDOC , " https://httpstat.us/429" , " -v" )
@@ -369,7 +367,7 @@ Section "FLAG COMBINATIONS"
369367Run- Test " flags/code-only+baeldung" " $OUT_DIR \edge\baeldung-code-only.md" @ ($RAWDOC , " https://www.baeldung.com/spring-kafka" , " --code-only" , " -v" )
370368Run- Test " flags/json+baeldung" " $OUT_DIR \edge\baeldung-json.json" @ ($RAWDOC , " https://www.baeldung.com/spring-kafka" , " -f" , " json" , " -v" )
371369Run- Test " flags/no-links+mdn" " $OUT_DIR \edge\mdn-no-links.md" @ ($RAWDOC , " https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" , " --no-links" , " -v" )
372- Run- Test " flags/no-tls-spoof+baeldung"" $OUT_DIR \edge\baeldung-no-spoof.md" @ ($RAWDOC , " https://www.baeldung.com/spring-kafka" , " --no-tls-spoof" , " -v" )
370+ Run- Test " flags/no-tls-spoof+baeldung" " $OUT_DIR \edge\baeldung-no-spoof.md" @ ($RAWDOC , " https://www.baeldung.com/spring-kafka" , " --no-tls-spoof" , " -v" )
373371Run- Test " flags/no-headless+react" " $OUT_DIR \edge\react-no-headless.md" @ ($RAWDOC , " https://react.dev/learn" , " --no-headless" , " -v" )
374372Run- Test " flags/timeout-short" " $OUT_DIR \edge\timeout-short.md" @ ($RAWDOC , " https://kubernetes.io/docs/concepts/workloads/pods/" , " --timeout" , " 2s" , " -v" )
375373Run- Test " flags/custom-header" " $OUT_DIR \edge\custom-header.md" @ ($RAWDOC , " https://kubernetes.io/docs/concepts/workloads/pods/" , " -header" , " X-Test=rawdoc" , " -v" )
0 commit comments