test(config): make define-config lint pass without dropping runtime tests#172
Merged
Conversation
`biome ci --error-on-warnings` flags the runtime-bypass tests' `any` cast and unused suppressions. The compile-time type constraint tests already cover the intended API guarantees, so remove the lint-only runtime escape hatches and format the file.
3 tasks
Rather than deleting the two runtime-guard tests to satisfy `biome ci --error-on-warnings`, keep them and rewrite the type bypasses to be lint-clean: - the undeclared-slug test now returns a well-typed BranchTuning and only bypasses the slug-narrowing guard via `as unknown as` (no `as any`) - the undefined-closure test uses `as unknown as BranchTuningFn` instead of an ineffective biome-ignore + `as never` This preserves coverage of the runtime guards (an undeclared slug can't fabricate a function; a closure returning undefined is treated as empty tuning) alongside the existing compile-time @ts-expect-error tests.
3 tasks
bayandin
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the failing
Lintjob from the merged static-config-shape PR without removing test coverage.biome ci --error-on-warningsflagged warnings inpackages/config/src/lib/define-config.test.ts:as anybiome-ignorecomments were ineffective / unusedInstead of deleting the two runtime-guard tests, this keeps them and rewrites the type bypasses so they pass
--error-on-warnings:BranchTuningand bypasses only the slug-narrowing guard viaas unknown as BranchTuningFn<…>(noas any).(() => undefined) as unknown as BranchTuningFninstead of an ineffectivebiome-ignore+as never(avoidsnoConfusingVoidTyperather than suppressing it).This keeps the runtime guards under test — an undeclared slug can't fabricate a function, and a closure returning
undefinedis treated as empty tuning — alongside the existing compile-time@ts-expect-errortests. Theas unknown asbypass matches the pattern already used elsewhere in this package's tests.Test plan
pnpm lint:cipnpm --filter @neondatabase/config tscpnpm --filter @neondatabase/config exec vitest run src/lib/define-config.test.ts(25 passed)