Skip to content

test: add shared test utilities package#15512

Closed
denolfe wants to merge 17 commits intomainfrom
test/helpers-package
Closed

test: add shared test utilities package#15512
denolfe wants to merge 17 commits intomainfrom
test/helpers-package

Conversation

@denolfe
Copy link
Copy Markdown
Member

@denolfe denolfe commented Feb 4, 2026

Overview

Introduces @tools/test-utils, a shared test utilities package under tools/test-utils/ that consolidates test helpers for reuse across the core repo and external repos via git submodule + pnpm workspace:* protocol.

Key Changes

  • New package @tools/test-utils at tools/test-utils/

    • Exports TypeScript source directly (no build step)
    • Multiple entry points: /int, /e2e, /shared, /database, /setup/vitest, /setup/playwright
  • Migrated test utilities from test/helpers/

    • Integration test helpers (SDK, REST client, seed utilities)
    • E2E/Playwright helpers (navigation, assertions, accessibility)
    • Database adapter generation (MongoDB, Postgres, SQLite, etc.)
    • Shared credentials and test email adapter
  • Backwards-compatible re-exports

    • Original test/helpers/ files now re-export from @tools/test-utils
    • Existing test imports continue to work unchanged

Design Decisions

Source exports over build: The package exports .ts files directly rather than compiled output. This simplifies the workflow since test utilities don't need publishing - consumers use workspace:* protocol which resolves to source.

Peer dependencies for flexibility: Database adapters, Playwright, Vitest, etc. are peer dependencies. This allows the package to work with whatever versions the consuming repo uses.

Informational typecheck: TypeScript typecheck filters to only show src/ errors (ignoring workspace package noise) and uses strict: false since this is test utility code. IDE provides real-time feedback; tests catch runtime issues.

Overall Flow

flowchart TD
    A["test/helpers/"] -->|re-exports| B["tools/test-utils"]
    C["test/*.spec.ts"] -->|imports| A
    D["External Repos"] -->|git submodule| B
    E["External repo tests"] -->|imports| B
    
    subgraph pkg ["tools/test-utils package"]
        B1["/int"]
        B2["/e2e"]
        B3["/shared"]
        B4["/database"]
    end
    
    B --> B1
    B --> B2
    B --> B3
    B --> B4
Loading

- Add incremental, isolatedModules, DOM lib to tsconfig.json
- Increase memory for typecheck script (8GB)
- Fix selectLivePreviewZoom.ts import path
- Fix preferences.ts SDK import paths
- Remove duplicate openDocDrawer from helpers.ts
- Add db adapter peer dependencies for types
- Replace external db adapter type imports with inline types
- Filter typecheck output to only show src/ errors
- Remove workspace db adapter devDependencies
Test utilities don't need strict type checking - IDE provides
real-time feedback and tests catch runtime issues.
@denolfe denolfe changed the title feat(test-utils): add shared test utilities package test: add shared test utilities package Feb 14, 2026
@denolfe
Copy link
Copy Markdown
Member Author

denolfe commented Mar 11, 2026

Diverged too far from main to resolve conflicts cleanly, will create new branch.

@denolfe denolfe closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant