test(sw): align regression tests with current components
This commit is contained in:
1 parent
3cbe879910
commit
b01ccaca01
5 files changed
+282
-31
No files matched your search
@@ -16,7 +16,15 @@ import { existsSync } from "node:fs"
|
||||
import { readFile, writeFile } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { fileURLToPath, pathToFileURL } from "node:url"
|
||||
import { approvedMainCommit } from "./storybook-inventory.mjs"
|
||||
// Reviewed main merge the approved surface must belong to (2026-11-10: own baseline, split from approvedMainCommit in
|
||||
// storybook-inventory.mjs, which also anchors the Story inventory / source regressions of overview, storybook-unused-
|
||||
// removal, dropdown-consolidation and storybook-cleanup-stage1; moving that one would accept their unrecorded Story and
|
||||
// source changes). Update it only in a reviewed test-only change that re-snapshots public-api.approved.json from a clean
|
||||
// build of that merge after its .d.ts changes were compared with the previous approved build.
|
||||
// History: approvedMainCommit fc65b2e (snapshot 8cb98b3) -> 3cbe879 (2026-11-10, Merge PR #30; snapshot from the clean
|
||||
// 3cbe879 build: SWProcess* exports of the user-approved Step Header adbb034 / e700825, optional shortLabel? of the SWViewerHeaderItem switch item in
|
||||
// cabd2f6, the internal SWHeaderLogo declaration of 205864b (not exported from the entry) and JSDoc-only changes).
|
||||
const approvedPublicApiMainCommit = "3cbe87991010f08b131e8b80c9f478c3fa721004"
|
||||
|
||||
const packageRoot = fileURLToPath(new URL("../", import.meta.url))
|
||||
const snapshotFile = fileURLToPath(new URL("./public-api.approved.json", import.meta.url))
|
||||
@@ -82,7 +90,7 @@ if (process.argv[2] === "--snapshot") {
|
||||
const results = []
|
||||
const check = (name, ok, data) => { results.push(ok); console.log(ok ? "PASS" : "FAIL", name, data === undefined ? "" : JSON.stringify(data)) }
|
||||
const ancestor = (a, b) => { try { execFileSync("git", ["merge-base", "--is-ancestor", a, b], { cwd: packageRoot, stdio: "ignore" }); return true } catch { return false } }
|
||||
check("approved surface comes from a reviewed commit (ancestor of approvedMainCommit and HEAD)", ancestor(approved.approvedCommit, approvedMainCommit) && ancestor(approved.approvedCommit, "HEAD"), { approvedCommit: approved.approvedCommit, approvedMainCommit })
|
||||
check("approved surface comes from a reviewed commit (ancestor of approvedPublicApiMainCommit and HEAD)", ancestor(approved.approvedCommit, approvedPublicApiMainCommit) && ancestor(approved.approvedCommit, "HEAD"), { approvedCommit: approved.approvedCommit, approvedPublicApiMainCommit })
|
||||
|
||||
const manifest = await manifestOf(manifestFile)
|
||||
const changedFields = ["name", ...manifestFields].filter(field => JSON.stringify(manifest[field]) !== JSON.stringify(approved.manifest[field]))
|
||||
|
||||
Reference in new issue
Block a user