Skip to content

packages/supabase: pnpm test:deno (tRPC router tests) fails to type-check via its documented command #421

Closed

Description

@thinkclay

Summary

pnpm test:deno (deno test --allow-all --config packages/supabase/tests/deno.json packages/supabase/tests) fails to even type-check, for all 34 files under packages/supabase/tests/routers/. Found while running nightly regression tests.

Root cause

The router test files use extensionless relative imports, e.g. in packages/supabase/tests/routers/teams.test.ts:

import { assertEquals, assertExists } from '../shared/assert';
import { callTRPCEndpoint } from '../shared/setup';

packages/supabase/tests/deno.json does not enable Deno's sloppy-imports unstable feature, and the deno test invocation in the root package.json (test:deno script) doesn't pass --unstable-sloppy-imports either. Deno requires exact extensions for local relative specifiers unless that flag is set, so every file in the suite fails with:

TS2307 [ERROR]: Cannot find module 'file:///.../tests/shared/assert'. Maybe add a '.ts' extension or run with --sloppy-imports

.vscode/settings.json does enable "deno.unstable": [..., "sloppy-imports", ...] for the editor extension, which is presumably why this has gone unnoticed — it works in VS Code's Deno tooling but not from the actual CLI command.

Verification

  • Confirmed via git log --follow -- packages/supabase/tests/deno.json: the file was added without the flag in commit 5473d98b3 and has never had it — this isn't a regression from a previously-green state.
  • Confirmed not wired into any CI workflow (grep -rn "test:deno" .github/workflows/ → no matches), so this has had zero CI signal since introduction.
  • Adding --unstable-sloppy-imports locally lets the suite actually execute (type-checking passes); at that point failures become genuine assertion failures against a live tRPC endpoint, a separate concern from this issue.

Suggested fix

Add "unstable": ["sloppy-imports"] to packages/supabase/tests/deno.json's compiler/runtime config (or add --unstable-sloppy-imports to the test:deno script in the root package.json), then decide whether to wire test:deno into CI or fix the imports to use explicit .ts extensions instead (more idiomatic Deno).

Environment

Found while running the nightly regression-test routine against main (commit at time of testing: see routine run). Reproduced locally with Deno v2.5.3.

Activity

  1. thinkclay commented on Jul 30, 2026

    @thinkclay
    ContributorAuthor

    Fixed in 6c6e5be0a. Added explicit extensions to every relative import across all 39 test files rather than enabling --unstable-sloppy-imports — no unstable flag, and it matches how the rest of the repo's Deno code resolves.

    tests/routers/*.ts (34 files) now type-checks clean, from "cannot find module" on every file. Getting there also required aligning tests/import_map.json with the trpc map and setting nodeModulesDir, and fixing 45 type errors the resolved imports exposed — including 30 uses of a getUserByEmail method that doesn't exist. Details in the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions