mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-31 10:55:57 +00:00
* feat(cli): save check, snapshot and render artifacts per revision * fix(cli): keep clean --snapshots inside the project A symlinked .hyperframes or artifacts folder was followed, so the command deleted snapshot and check files outside the project. * test(cli): keep check, snapshot, and render successful when recording fails A held history or a corrupt output registry warns and leaves the command result alone. * fix(cli): drop snapshot records when a replaced run is not recorded A reused --output rewrites the files even when history is busy. Those records are removed so the old revision does not keep the new pixels. The preview checkpoint stops waiting after five seconds. A bad PNG header no longer fails the snapshot. * fix(studio-server): keep the video-state comment share from rising The forget helper's doc comment pushed the file above its base share. * fix(cli): post the preview checkpoint and keep cleanup inside artifacts A preview checkpoint with no body was sent as GET, so Studio never ran it. Cleanup now requires the real path to stay under the artifacts folder. A failed follow-up drop does not warn twice. The studio-server unpacked budget covers the record-dropping helper. * docs(cli): shorten the snapshot skill notes The command examples already show range and composition. The prose only keeps the output path and the flags that are easy to misuse. * chore: leave package headroom for artifact cleanup * test(cli): compare artifact paths portably * style(cli): format portable artifact assertion
67 lines
3.0 KiB
TypeScript
67 lines
3.0 KiB
TypeScript
import { copyFileSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join, resolve } from "node:path";
|
|
import { defineConfig } from "vitest/config";
|
|
// Before workers fork, as below: the test run gets a home folder of its own.
|
|
import "./scripts/test-home.mjs";
|
|
|
|
// Windows: sharp's first text render builds Fontconfig's cache for every OS font (about 9 s on a
|
|
// fresh runner). Set here, before workers fork, because an in-process env write never reaches it.
|
|
if (process.platform === "win32") {
|
|
const dir = mkdtempSync(join(tmpdir(), "hf-vitest-fontconfig-"));
|
|
process.once("exit", () => rmSync(dir, { recursive: true, force: true }));
|
|
copyFileSync(
|
|
join(process.env.WINDIR ?? "C:\\Windows", "Fonts", "arial.ttf"),
|
|
join(dir, "arial.ttf"),
|
|
);
|
|
const file = join(dir, "fonts.conf");
|
|
writeFileSync(
|
|
file,
|
|
`<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><fontconfig><dir>${dir}</dir><cachedir>${dir}</cachedir></fontconfig>`,
|
|
);
|
|
process.env.FONTCONFIG_FILE = file;
|
|
}
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: /^@hyperframes\/studio-server\/history$/,
|
|
replacement: resolve(__dirname, "../studio-server/src/history/index.ts"),
|
|
},
|
|
// Resolve the bare @hyperframes/core entry to TypeScript source, not built
|
|
// dist. The published dist intentionally omits runtime/entry.ts, so the
|
|
// dist build of loadHyperframeRuntimeSource() returns null — which makes
|
|
// studioServer.test.ts's runtime-source equality assertion diverge. Tests
|
|
// run under bun against source; subpath imports (@hyperframes/core/*) keep
|
|
// resolving via the package's export conditions.
|
|
{
|
|
find: /^@hyperframes\/core$/,
|
|
replacement: resolve(__dirname, "../core/src/index.ts"),
|
|
},
|
|
// Same reason the tsup build aliases this specifier to source: the CLI
|
|
// bundles the producer rather than depending on it at runtime, so its
|
|
// dist is not built for the test job. Without the alias, vite's import
|
|
// analysis resolves studioServer.ts's `import("@hyperframes/producer")`
|
|
// against an unbuilt package and the whole suite fails to collect.
|
|
{
|
|
find: /^@hyperframes\/producer$/,
|
|
replacement: resolve(__dirname, "../producer/src/index.ts"),
|
|
},
|
|
],
|
|
},
|
|
test: {
|
|
include: ["src/**/*.test.ts"],
|
|
// Many CLI tests cold-import a heavy command module graph via dynamic
|
|
// `import()` (e.g. render.js, auth/status.js, telemetry/system.js). Under
|
|
// the full parallel monorepo run (`bun run --filter '!@hyperframes/producer'
|
|
// test`) that cold load contends for CPU and routinely blows vitest's 5s
|
|
// default test timeout / 10s hook timeout on CI runners — a recurring
|
|
// flake that has failed unrelated PRs (see PRs #1843, #1850). These
|
|
// generous ceilings absorb the contention while still catching a genuine
|
|
// hang. Prefer this one config knob over per-test/per-hook timeout bandaids.
|
|
testTimeout: 20_000,
|
|
hookTimeout: 30_000,
|
|
},
|
|
});
|