Files
hyperframes/scripts/check-media-use-audio-carve-generated.test.mjs
T
Miguel Ángel 25c6035212 fix(media-use): carve runs its own copy of core's analysis, never the project's (#7926)
* fix(media-use): carve runs its own copy of core's analysis, never the project's

carve.mjs loaded @hyperframes/core from the composition's own node_modules, so carving
a project ran whatever that project shipped under that name. It now imports a bundle
of core's carve and audio-fx functions generated beside it, with a test that fails
when the bundle drifts from core's source.

* fix(media-use): lint and format skip the carve bundle on the CLI path too
2026-11-16 05:52:09 +00:00

22 lines
950 B
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { describe, it } from "node:test";
import { generate } from "./generate-media-use-audio-carve.mjs";
// The carve analysis lives in packages/core/src/audioCarve.ts and audioFx.ts; the skill's copy is a generated
// bundle. This trips on a hand edit of the bundle or a source change that was not regenerated.
describe("media-use audio-carve.mjs matches a fresh regeneration", () => {
it("is byte-identical to `node scripts/generate-media-use-audio-carve.mjs`", async () => {
const committed = readFileSync(
resolve(import.meta.dirname, "../skills/media-use/audio/scripts/lib/audio-carve.mjs"),
"utf8",
);
assert.equal(
committed,
await generate(),
"skills/media-use/audio/scripts/lib/audio-carve.mjs is stale. Run: node scripts/generate-media-use-audio-carve.mjs",
);
});
});