Skip to content

test(zod): compile generated schema text - #449

Merged
robgruen merged 1 commit into
mainfrom
test/zod-generated-schema-compilation
Oct 12, 2026
Merged

robgruen merged 1 commit into
mainfrom
test/zod-generated-schema-compilation

Conversation

@robgruen

Copy link
Copy Markdown
Contributor

Summary

  • Collect schema text emitted by the existing Zod tests and type-check it together with the installed TypeScript compiler using strict and noEmit.
  • Compile each snippet as a separate module so repeated test type names do not collide and named references remain intact.
  • Preserve the existing regex assertions, include getSchemaText() output, and clean up temporary files on success and failure.
  • Add negative controls for invalid tuple syntax and unresolved type references.
  • Document the compiler-backed checks in the TypeScript README.

Context

This implements the compiler-validation suggestion from the review of #445. It is based on main and does not duplicate that PR's precedence fix or regression tests. The shared schema helper will also collect and compile #445's new test output when that PR merges.

Validation

  • npm run build: passed.
  • Local TypeScript compiler, tsc -p test: passed.
  • node --test --test-reporter=spec out\zod.test.js: 51 tests passed, including both negative controls and the batch compilation hook.
  • git diff --check: passed.

Local validation used Windows, TypeScript 7.0.2, and Node 22.18.0. The local Node version is slightly below the package's >=22.19.0 requirement; supported-version CI should still run before merging.

Batch type-check generated schema text while preserving existing regex assertions. Add negative controls for invalid tuple syntax and unresolved type references, and document the compiler-backed checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@robgruen
robgruen merged commit b0b34dc into main Oct 12, 2026
12 checks passed
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