Cotton code
18 lines · 968 B · TypeScriptRaw
/** * RULE: the Worker's rules module is built from the cotton-rules it says. * `pnpm rules:wasm` writes apps/business/src/rules/wasm/ and a stamp of the * sources it built from; a change to crates/cotton-rules (or its WASM shim, or * the build script) without a rebuild leaves the Worker running yesterday's * rules, and this fails until `pnpm rules:wasm` is run and its output checked in. */import { readFileSync } from "node:fs";import { join } from "node:path";import { describe, expect, it } from "vitest";import { ROOT, rulesStamp, STAMP_FILE } from "../rules/stamp";describe("the Worker's rules module", () => {  it("was built from the cotton-rules sources on this tree (pnpm rules:wasm)", () => {    const stamp = JSON.parse(readFileSync(join(ROOT, STAMP_FILE), "utf8")) as { sources: string };    expect(stamp.sources, "crates/cotton-rules moved on: run pnpm rules:wasm and check in apps/business/src/rules/wasm").toBe(rulesStamp());  });});