Skip to content

Commit 0bfe4f7

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(design-studio): verify fixture freshness and use shared import alias
1 parent 26f88ed commit 0bfe4f7

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎scripts/design-studio/refresh.test.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,18 @@ test('refresh tracks source changes in imported stylesheets', () => {
283283
assert.notEqual(changed.sourceRevision, first.sourceRevision)
284284
}, 60000)
285285

286+
test('fixture edits invalidate the published checkout revision', () => {
287+
const { repo, refresh } = guardedRefresh()
288+
const first = refresh()
289+
const file = 'tools/design-studio/_components/component-fixtures.tsx'
290+
write(repo, file, `${readFileSync(path.join(repo, file), 'utf8')}\n// revised fixture`)
291+
const changedRevision = workingTreeRevision(repo)
292+
assert.notEqual(changedRevision, first.sourceRevision)
293+
const changed = refresh()
294+
assert.equal(changed.sourceRevision, changedRevision)
295+
assert.notEqual(changed.fixtureHash, first.fixtureHash)
296+
}, 60000)
297+
286298
test('refresh requires a fixture mapping for each variant axis', () => {
287299
const { refresh } = guardedRefresh()
288300
const manifest = refresh()

‎tools/design-studio/_lib/manifest.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { execFileSync } from 'node:child_process'
44
import { existsSync, readFileSync } from 'node:fs'
55
import { homedir } from 'node:os'
66
import path from 'node:path'
7-
import { workingTreeRevision } from '../../../scripts/design-conformance/shared/source-revision'
7+
import { workingTreeRevision } from '#design-conformance/shared/source-revision'
88

99
export interface StudioLocation {
1010
file: string
@@ -122,6 +122,7 @@ export function getStudioPageManifest(mode: 'components' | 'extras'): {
122122
cwd: process.env.SIM_STUDIO_REPO ?? process.cwd(),
123123
encoding: 'utf8',
124124
}).trim()
125+
// This revision includes fixture adapters and contracts as well as product source.
125126
stale = workingTreeRevision(repo) !== manifest.sourceRevision
126127
} catch {
127128
stale = true

0 commit comments

Comments
 (0)