Skip to content

test(cloudflare-integration-tests): Type-check test suites in CI#22068

Merged
mydea merged 1 commit into
developfrom
feat/cloudflare-integration-tests-type-check
Jul 8, 2026
Merged

test(cloudflare-integration-tests): Type-check test suites in CI#22068
mydea merged 1 commit into
developfrom
feat/cloudflare-integration-tests-type-check

Conversation

@mydea

@mydea mydea commented Jul 8, 2026

Copy link
Copy Markdown
Member

The suites/** files in cloudflare-integration-tests were never type-checked in CI: there was no type-check script, and vitest transpiles with esbuild (no type-checking). 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.

Changes

  • Add a type-check script (tsc --noEmit) and run yarn type-check for the package in the Lint CI job.
  • Worker fixtures (suites/tracing/propagation/**): drop an incorrect implements RpcTarget (Durable Objects expose their public methods over RPC inherently), and let the WorkerEntrypoint classes use the ambient Cloudflare.Env — which is what withSentry's WorkerEntrypointConstructor requires — casting this.env to the local Env for binding access. (A global Cloudflare.Env augmentation would be more idiomatic but collides across fixtures that declare the same binding name with different DO classes into one tsc program.)
  • AI assertions (google-genai / langchain / langgraph test files): type the span callback params as SerializedStreamedSpan.
  • Narrow envelope items before accessing .spans in the durable-object tests, and fix the runner's Expected argument typing.
  • Targeted, commented casts for version-skewed AI mocks (LangChain callback handler, OpenAI mock client, vercel AI mock language model).
  • Exclude 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-tests and bun-integration-tests #22059). deno-integration-tests is intentionally skipped — it's a Deno project (deno test --no-check) that tsc can't type-check (URL imports, Deno globals).

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>
@mydea mydea requested a review from a team as a code owner July 8, 2026 09:42
@mydea mydea requested review from JPeer264 and andreiborza and removed request for a team July 8, 2026 09:42

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thx for taking care.

@mydea mydea merged commit 616435f into develop Jul 8, 2026
85 checks passed
@mydea mydea deleted the feat/cloudflare-integration-tests-type-check branch July 8, 2026 10:23
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