Files
supabase/packages/pg-meta/package.json
Charis f051c6a1c1 refactor(pg-meta): consolidate test scripts and support parallel test runs across worktrees (#45340)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Refactor of the pg-meta test setup scripts.

## What is the current behavior?

The test command runs multiple sequential npm-run-s scripts (`db:clean`,
`db:run`, `test:run`, `db:clean`) with a hardcoded port 5432, causing
container name and port collisions when running tests across multiple
git worktrees in parallel.

## What is the new behavior?

A single `test/run-tests.sh` wrapper script handles the full test
lifecycle: it finds an available port dynamically (scanning 5432–5531),
sets a unique Docker Compose project name based on a hash of the package
directory path, starts the DB, runs the test command, and tears down on
exit. This allows pg-meta tests to run in parallel across multiple
worktrees without conflicts.

## Additional context

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Streamlined test execution to centralize setup and teardown for
reliable runs.
* Made the test database port configurable with automatic local port
discovery and fail-fast behavior.
* Created isolated test environments per workspace to avoid
container/name collisions and improve cleanup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-28 16:34:56 -04:00

30 lines
769 B
JSON

{
"name": "@supabase/pg-meta",
"version": "0.0.0",
"license": "MIT",
"author": "Supabase",
"main": "./src/index.ts",
"repository": "supabase/supabase",
"scripts": {
"preinstall": "npx only-allow pnpm",
"clean": "rimraf node_modules .turbo tsconfig.tsbuildinfo",
"test": "test/run-tests.sh vitest run --coverage",
"test:update": "test/run-tests.sh vitest run --update",
"lint": "tsc --noEmit",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"zod": "catalog:"
},
"devDependencies": {
"@types/pg": "^8.11.11",
"@vitest/coverage-v8": "catalog:",
"npm-run-all": "^4.1.5",
"pg": "^8.13.1",
"postgres-array": "^3.0.2",
"typescript": "catalog:",
"vite": "catalog:",
"vitest": "catalog:"
}
}