Przeglądaj źródła

fix: preserve malformed snapshot fixtures

Tianyi Cui 3 miesięcy temu
rodzic
commit
287041e39e
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      packages/support/acp-snapshot/src/suite.ts

+ 4 - 2
packages/support/acp-snapshot/src/suite.ts

@@ -486,8 +486,10 @@ export function defineAcpSnapshotSuite(options: SnapshotSuiteOptions): void {
             const entries = await readdir(dir, { withFileTypes: true })
             await Promise.all(entries
               .filter(entry => entry.isFile()
-                && entry.name.startsWith('session.')
-                && entry.name.endsWith('.jsonl')
+                // Only valid numbered children are record-owned stale output.
+                // Malformed session-like names stay for the inventory guard to
+                // reject instead of being silently deleted during mutation.
+                && /^session\.[1-9]\d*\.jsonl$/.test(entry.name)
                 && !outputNames.has(entry.name))
               .map(entry => rm(join(dir, entry.name))))
             fixtureFiles = outputFixtureFiles