Skip to content

sdqede/pgpm-example

Repository files navigation

pgpm-example

Verify .sql watch (module1)

# Install dependencies (repo root)
pnpm install

# Run Jest in watch mode (uses your Docker Postgres on localhost:5432)
cd packages/module1
PGHOST=localhost PGPORT=5432 PGUSER=postgres PGPASSWORD=password pnpm test:watch -- __tests__/basic.test.ts

Why --watchAll can be better for .sql: jest --watch tries to re-run only tests “related” to the changed file via Jest’s dependency graph. If your tests load SQL via fs.readFileSync (not import/require), Jest can’t reliably infer that relationship in larger suites. jest --watchAll re-runs the suite on any watched change, so .sql edits always trigger the tests.

Then edit and save packages/module1/__tests__/watch.sql (e.g. change SELECT 1 AS num;SELECT 2 AS num;). Jest should rerun automatically; change it back to make the test pass again.

Getting Started

This workspace was generated with pgpm init workspace. For a complete guide on developing with pgpm workspaces, see Workspaces: Organize Postgres.

Quick Start

# Install dependencies
pnpm install

# Start PostgreSQL (requires Docker)
pgpm docker start

# Load environment variables
eval "$(pgpm env)"

# Create a module
pgpm init

# Navigate to your module and run tests
cd packages/your-module
pnpm test:watch

Prerequisites

  • Node.js 20+
  • pnpm
  • Docker
  • PostgreSQL client tools (psql)
  • pgpm (npm install -g pgpm)

See Prerequisites for detailed setup instructions.

Credits

🛠 Built by LaunchQL — checkout our github ⚛️

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published