mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
16 lines
680 B
JavaScript
16 lines
680 B
JavaScript
import { sourceFingerprint } from '../scripts/source-fingerprint.mjs';
|
|
|
|
/** Refuse measurements/screenshots made by a committed bundle from old source. */
|
|
export async function assertFreshDemoBundle(page, root = process.cwd()) {
|
|
const expected = sourceFingerprint(root);
|
|
const loaded = await page.evaluate(() => globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__ ?? null);
|
|
if (loaded !== expected) {
|
|
throw new Error(
|
|
'demo/srv/assets/houseplan-card.js is stale. Run npm run build and copy '
|
|
+ 'dist/houseplan-card.js to demo/srv/assets/houseplan-card.js first. '
|
|
+ `Expected ${expected}, loaded ${loaded || 'no fingerprint'}.`,
|
|
);
|
|
}
|
|
return expected;
|
|
}
|