Skip to content

test(config): make define-config lint pass without dropping runtime tests#172

Merged
andrelandgraf merged 2 commits into
mainfrom
fix/static-config-lint-ci
Jun 9, 2026
Merged

test(config): make define-config lint pass without dropping runtime tests#172
andrelandgraf merged 2 commits into
mainfrom
fix/static-config-lint-ci

Conversation

@andrelandgraf

@andrelandgraf andrelandgraf commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the failing Lint job from the merged static-config-shape PR without removing test coverage.

biome ci --error-on-warnings flagged warnings in packages/config/src/lib/define-config.test.ts:

  • a runtime-bypass test used as any
  • two biome-ignore comments were ineffective / unused

Instead of deleting the two runtime-guard tests, this keeps them and rewrites the type bypasses so they pass --error-on-warnings:

  • undeclared-slug test: returns a well-typed BranchTuning and bypasses only the slug-narrowing guard via as unknown as BranchTuningFn<…> (no as any).
  • undefined-closure test: uses (() => undefined) as unknown as BranchTuningFn instead of an ineffective biome-ignore + as never (avoids noConfusingVoidType rather than suppressing it).

This keeps the runtime guards under test — an undeclared slug can't fabricate a function, and a closure returning undefined is treated as empty tuning — alongside the existing compile-time @ts-expect-error tests. The as unknown as bypass matches the pattern already used elsewhere in this package's tests.

Test plan

  • pnpm lint:ci
  • pnpm --filter @neondatabase/config tsc
  • pnpm --filter @neondatabase/config exec vitest run src/lib/define-config.test.ts (25 passed)

`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.
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.
@andrelandgraf andrelandgraf changed the title test(config): remove lint-only suppressions from define-config tests test(config): make define-config lint pass without dropping runtime tests Jun 9, 2026
@andrelandgraf andrelandgraf enabled auto-merge (squash) June 9, 2026 15:35
@andrelandgraf andrelandgraf merged commit 4f1f083 into main Jun 9, 2026
8 checks passed
@andrelandgraf andrelandgraf deleted the fix/static-config-lint-ci branch June 9, 2026 15:40
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