Skip to content

test(hub): isolate Vitest state and worker databases - #112

Open
Copilot wants to merge 2 commits into
copilot/hub-postgres-prismafrom
copilot/hub-vitest-isolation
Open

Copilot wants to merge 2 commits into
copilot/hub-postgres-prismafrom
copilot/hub-vitest-isolation

Conversation

Copilot AI commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Hub contributors need independent test cases without repeating cleanup hooks in every file. Database tests also need to run in parallel without sharing records or clearing the development database. Closes #111.

This PR is stacked on #108 and targets its copilot/hub-postgres-prisma branch.

What changes

Shared setup restores test state before each case, including mocks, environment changes, timers, browser storage, and leftover document content. Redundant local cleanup hooks are removed. Tests still explicitly dispose resources they create, such as listeners and servers.

Vitest runs files in parallel using forked processes and keeps cases within each worker sequential. A dedicated server test project prepares the current Prisma schema in a new template database, then creates a separate database for each worker. Before every case it clears application records and restarts identities, while retaining migration records. Unique run names isolate simultaneous runs, and teardown drops only databases created by that run.

npm test remains database-free. npm run test:database runs .db.test.ts server cases using TEST_DATABASE_URL; only this CI command starts PostgreSQL. The contributor guides document the lifecycle and require each case to arrange its own records, act, and assert.

CI runs individual checks on every pull request without changed-path selection or aggregate result gates. The old selector and its tests are removed, Starter and Learning no longer filter changed paths, and repository tooling has independent checks. Hub's test jobs are named Hub unit tests and Hub database tests.

Repository branch rules are unchanged. Maintainers must replace the removed aggregate checks and legacy Hub checks in applicable rules before requiring the new workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI requested review from a team and nshki as code owners October 23, 2026 23:39
Copilot AI max review requested due to automatic review settings October 23, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because there is no eligible user to bill.

An enterprise owner can allow the organization to be billed for reviews like this by enabling Copilot code review for users without a license.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants