Files
civitai__civitai/scripts
briant ba7504aac3 fix(tests): make seven suites pass on Windows
17 tests across 7 files failed on a Windows checkout and pass on CI. None was a
product defect; all were portability bugs in the harness code, and two of them
were reporting the thing under test as broken when it was not.

Path separators. `path.relative` yields backslashes on Windows while the ledgers
these tests compare against are written with `/`, so the walk matched nothing and
the ledger read as "no consumers" — `rating-label`, `model-file-hash-writers`,
`dev-server-daemon-port`. Normalised at the walk.

`new URL(..).pathname` gives `/C:/…`, which resolves to `C:\C:\…` and ENOENTs —
`appListingStatChips` now uses `fileURLToPath`.

`standalone-boot-graph` asserted on `esm/index.js` in output where Node prints a
NATIVE path.

`dev-server-daemon-port` spawned `import(<absolute windows path>)`, which ESM
rejects with ERR_UNSUPPORTED_ESM_URL_SCHEME because the drive letter parses as a
scheme. The child exited 1 and the test — "can be imported without throwing" —
reported the daemon as broken for a reason unrelated to the daemon. Now
`pathToFileURL`.

Two are genuine environment limits and are SKIPPED rather than weakened, so the
gap stays visible. The three symlink CONTROLs in `source-nul-bytes` need
elevation on Windows (EPERM, reproduced); they are gated on a capability probe
rather than `process.platform`, so Linux CI and an elevated shell still run them,
and the main NUL-byte assertion is untouched. `typecheck-apps` puts a
`#!/usr/bin/env bash` fake `pnpm` on PATH with `chmod 0755` — neither means
anything on Windows — so it is skipped there; its `:` PATH separator is fixed to
`path.delimiter` regardless.

Counts, since skips can hide regressions: 19502 passed + 27 skipped + 17 failed
before, 19506 passed + 40 skipped + 0 failed after. Same 19546 total; the 13 new
skips are exactly the 3 symlink controls and the 10 typecheck-apps cases.

Also clears two pre-existing eslint errors in a file already being touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 16:23:17 -06:00
..
2026-06-04 15:58:33 -06:00