test(cloudflare-integration-tests): Type-check test suites in CI#22068
Merged
Conversation
The `suites/**` files were never type-checked in CI: there was no `type-check` script and vitest transpiles with esbuild. The suites are already covered by `tsconfig.json`, so this adds a gate and fixes the ~30 latent type errors it surfaced. All fixes are type-only; no runtime behavior changed. - Add a `type-check` script (`tsc --noEmit`) and run it in the Lint CI job. - Worker fixtures: drop incorrect `implements RpcTarget` (DurableObjects expose RPC inherently), and let WorkerEntrypoint classes use the ambient `Cloudflare.Env` (which `withSentry`'s `WorkerEntrypointConstructor` requires), casting `this.env` to the local `Env` for binding access. - AI assertions: type the `span` callback params as `SerializedStreamedSpan`. - Narrow envelope items before accessing `.spans` in durable-object tests. - Fix the runner's `Expected` argument typing. - Targeted casts for version-skewed AI mocks (LangChain callback handler, OpenAI mock client, vercel AI mock language model). - Exclude `suites/prisma/**` (imports a Prisma-generated client that only exists after codegen). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
The
suites/**files incloudflare-integration-testswere never type-checked in CI: there was notype-checkscript, and vitest transpiles with esbuild (no type-checking). The suites are already covered bytsconfig.json, so this adds a gate and fixes the ~30 latent type errors it surfaced. All fixes are type-only — no runtime behavior changed.Changes
type-checkscript (tsc --noEmit) and runyarn type-checkfor the package in the Lint CI job.suites/tracing/propagation/**): drop an incorrectimplements RpcTarget(Durable Objects expose their public methods over RPC inherently), and let theWorkerEntrypointclasses use the ambientCloudflare.Env— which is whatwithSentry'sWorkerEntrypointConstructorrequires — castingthis.envto the localEnvfor binding access. (A globalCloudflare.Envaugmentation would be more idiomatic but collides across fixtures that declare the same binding name with different DO classes into one tsc program.)google-genai/langchain/langgraphtest files): type thespancallback params asSerializedStreamedSpan..spansin the durable-object tests, and fix the runner'sExpectedargument typing.suites/prisma/**from the check — it imports a Prisma-generated client (./generated) that only exists after codegen.Part of a small series adding suite type-checking to the integration-test packages (alongside
node-integration-testsandbun-integration-tests#22059).deno-integration-testsis intentionally skipped — it's a Deno project (deno test --no-check) thattsccan't type-check (URL imports,Denoglobals).