mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 08:01:26 +00:00
2105540cca
* feat: add session recording to wmill app dev * fix: harden dev recorder shell, bundle staleness guard and save route * fix: keep dev-server recordings out of the raw app sync diff * style: drop em dashes from new cli comments * fix: tighten dev recorder save route origin, naming and io * test: pin that only the root recordings folder is skipped * fix: survive an oversized recording upload and match paths on windows * fix: keep the app at the root and settle runnables stranded by a reload * fix: make the recorder bundle hash stable on a crlf checkout * docs: state the preflight-free content type the origin check guards * test: build the sync-skip fixture with the platform separator * docs: align the origin-guard test comment with the code * chore: mark generated .gen.ts files as generated
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/**
|
|
* The recorder `wmill app dev --recording` serves is generated from the
|
|
* frontend's raw-app recorder, not written here, so it can silently ship a stale
|
|
* event model after that recorder changes. The committed bundle records the
|
|
* sources it was built from and their hash; this fails when they no longer
|
|
* agree.
|
|
*
|
|
* Fix a failure with `bun run gen:dev-recorder` from cli/.
|
|
*/
|
|
|
|
import { describe, expect, test } from "bun:test";
|
|
import * as fs from "node:fs";
|
|
import * as path from "node:path";
|
|
import { hashRecorderSources } from "../generate-dev-recorder.ts";
|
|
import {
|
|
DEV_RECORDER_BUNDLE,
|
|
DEV_RECORDER_SOURCE_HASH,
|
|
DEV_RECORDER_SOURCES,
|
|
} from "../src/commands/app/devRecorderBundle.gen.ts";
|
|
|
|
const REPO_ROOT = path.join(import.meta.dir, "..", "..");
|
|
|
|
describe("dev recorder bundle", () => {
|
|
test("exposes the recorder factory as a global", () => {
|
|
expect(DEV_RECORDER_BUNDLE).toContain("__wmillRecorder");
|
|
expect(DEV_RECORDER_BUNDLE).toContain("createRawAppRecording");
|
|
// Runes are stripped at generation; one left in would throw at load time.
|
|
expect(DEV_RECORDER_BUNDLE).not.toContain("$state");
|
|
});
|
|
|
|
test("is up to date with the frontend recorder", () => {
|
|
expect(DEV_RECORDER_SOURCES.length).toBeGreaterThan(0);
|
|
const present = DEV_RECORDER_SOURCES.every((f) =>
|
|
fs.existsSync(path.join(REPO_ROOT, f))
|
|
);
|
|
// The published CLI package ships without the frontend sources.
|
|
if (!present) return;
|
|
expect(hashRecorderSources(DEV_RECORDER_SOURCES, REPO_ROOT)).toBe(
|
|
DEV_RECORDER_SOURCE_HASH,
|
|
);
|
|
});
|
|
});
|