mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-08-31 02:41:44 +00:00
`main`'s Test job is red: studioServer.test.ts fails to collect with "Failed to
resolve entry for package @hyperframes/producer".
studioServer.ts has long carried `await import("@hyperframes/producer")`, but
nothing under test imported that module until #2591 added a suite that does.
Vite's import analysis resolves the specifier at transform time, and the CI test
job builds only parsers, lint, studio-server and core, so the package has no
dist to resolve and the whole file fails to collect. It passes locally only
because a full `bun run build` happens to build the producer first.
The tsup build already aliases this specifier to the producer's source, because
the CLI bundles the producer rather than depending on it at runtime. The test
config now resolves it the same way, so the tooling agrees with the build. The
neighbouring @hyperframes/core alias exists for the same class of reason.
Config only: no source change, so the shipped bundle still inlines the producer
and installed users are unaffected.
Verified by reproducing the CI condition locally (producer dist removed):
studioServer.test.ts fails without this change and passes with it, and the built
cli.js still contains no runtime import of @hyperframes/producer.
42 lines
1.9 KiB
TypeScript
42 lines
1.9 KiB
TypeScript
import { resolve } from "node:path";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: [
|
|
// 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,
|
|
},
|
|
});
|