Skip to content

test(platform): the client project in vitest.config.ts is a second jsdom suite that disagrees with the one CI runs #5381

Closed

Description

@yannickmonney

Summary

services/platform/vitest.config.ts defines a client project (jsdom, tests/setup-ui.ts) that nothing in the repository runs. CI and bun run check run the jsdom suite through vitest.ui.config.ts (test:ui). The two configurations differ, and so do their results:

  • 3 tests in api-key-create-dialog.test.tsx fail under the client project and pass under vitest.ui.config.ts.
  • The client project leaves out the 35 test files under app/routes/.

A local check of the chat agents epic (#5371) ran the client project. It reported those 3 tests as failing on main, and it missed 6 route tests that test:ui then caught (fixed in f163a9c90).

What the repository says today (main 9be27c4e2)

  • The client project: services/platform/vitest.config.ts:142-156. It sets environment: 'jsdom', setupFiles: ['./tests/setup-ui.ts'], and includes app/components, app/features and app/hooks. It inherits the root's plugins (YAML imports, message topics), resolve.dedupe and optimizeDeps.
  • services/platform/vitest.ui.config.ts:23-87 adds react(), globals: true, pool: 'threads', maxWorkers, onConsoleLog, css: true and a deps.optimizer.web list. It also includes app/routes/** and excludes backend/**.
  • Scripts: test runs --project server --project pii, and test:ui runs vitest.ui.config.ts (services/platform/package.json:20, :26). CI runs test:ui in four shards (.github/workflows/checks.yml:487). No script, workflow or doc names --project client.
  • A bare bunx vitest --run in services/platform runs every project of vitest.config.ts, the client and storybook projects included.

What was observed (macOS, Bun 1.4.2, 2026-11-05)

Command api-key-create-dialog.test.tsx
bunx vitest --run --project client <file> 3 failed, 24 passed: "Unable to perform pointer interaction as the element has pointer-events: none" on the calendar's day cells and on Previous month
the same with TZ=UTC the same 3 fail
the same with --pool=threads --globals the same 3 fail
bunx vitest --run --config vitest.ui.config.ts <file> 27 passed

The test fakes the clock (vi.useFakeTimers({ toFake: ['Date'] }), setSystemTime to 2026-10-07), so the date it runs on does not matter.

Not examined: which remaining difference causes the failures (react(), css: true, the optimizer list, dedupe); whether an editor's Vitest extension runs the client project.

Options (no preference)

  1. Remove the client project, so vitest.ui.config.ts is the one jsdom suite.
  2. Define the jsdom suite once and use it in both places: the client project points at the vitest.ui.config.ts settings, or the other way round.
  3. Keep both, with a guard that they include the same files and run the same way.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions