Skip to content

test(core): isolate local font fallback from system discovery - #5360

Queued
user-github-me wants to merge 1 commit into
heygen-com:mainfrom
user-github-me:test/local-font-fallback-isolation
Queued

user-github-me wants to merge 1 commit into
heygen-com:mainfrom
user-github-me:test/local-font-fallback-isolation

Conversation

@user-github-me

Copy link
Copy Markdown
Contributor

The local-fallback case in deterministicFonts-googleSubsets.test.ts writes a fake font into the user's font directory and discovers it through the real system-font locator. On macOS that invokes system_profiler, whose five-second timeout can consume the test's own five-second deadline. The unchanged suite reproduces this locally with 22 passes and one timeout.

Keep the font fixture in the suite's temporary directory and stub only the system-font lookup with a typed result. Restore the spy after every test. The existing assertion still checks that the compiler embeds the fixture bytes, and the failed authored-link case now explicitly verifies that the system locator is not called.

Validation: all 23 tests in this file, all 258 font tests, and the full 4,401-test core suite pass. Disabling local fallback and ignoring the authored-link restriction each fail the intended assertion, confirming the isolated tests still detect both regressions. Workspace build, core typecheck, repository lint, formatting, comment checks, test reachability, and the normal pre-commit hooks pass. Production font resolution is unchanged.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-only change, and it does what it says. The fixture now lives in the suite's temp dir instead of the real user font directory, and locateSystemFontVariants is stubbed per test with restoreAllMocks in afterEach, so the macOS system_profiler path can no longer eat the 5s test budget or leave a stray file in ~/Library/Fonts. I checked that systemFamilyFaceRules in deterministicFonts.ts goes through locateSystemFontVariants(lookupFamily) and then readFileSync(variant.path), so returning the temp path still exercises the real embed path. The two new call assertions make both cases stronger: the failed authored-link case now proves the locator is never consulted, not just that the bytes are missing. The file is unchanged on main since the PR base, so it is still relevant.

— Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Oct 24, 2026
@jrusso1020
jrusso1020 removed this pull request from the merge queue due to a manual request Oct 24, 2026
@jrusso1020
jrusso1020 added this pull request to the merge queue Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants