Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ---------------------------------------------------------------------------
# Env for the integration test suite (`pnpm test`). Not secret — points at a
# disposable local database (dropped + recreated on every run) and a
# dedicated port so it never collides with `pnpm dev`.
#
# THIS FILE IS COMMITTED TO GIT. DO NOT PUT REAL SECRETS HERE.
# ---------------------------------------------------------------------------

DATABASE_URL="postgresql://skipdb:skipdb@localhost:5433/skipdb_test"
AUTH_SECRET="test-secret-do-not-use-in-production-aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
AUTH_URL="http://localhost:3100"
NEXT_PUBLIC_BASE_URL="http://localhost:3100"
NEXT_PUBLIC_API_URL="http://localhost:3100"
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
pull_request:
push:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: skipdb
POSTGRES_PASSWORD: skipdb
POSTGRES_DB: skipdb
ports:
- 5433:5432
options: >-
--health-cmd="pg_isready -U skipdb"
--health-interval=5s
--health-timeout=5s
--health-retries=10

steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6

- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm

- run: pnpm install --frozen-lockfile

- name: Test
run: pnpm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
.next
.next-test
out
.env
.env*.local
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "dotenv/config";
import "./src/lib/load-env";
import { defineConfig } from "drizzle-kit";

const url =
Expand Down
4 changes: 4 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// The test suite runs its own `next dev` alongside a normal one in the same
// checkout — Next.js locks one dev server per distDir, so give the test
// server a separate build output dir to avoid colliding with it.
...(process.env.SKIPDB_TEST_SERVER ? { distDir: ".next-test" } : {}),
images: {
remotePatterns: [
{ protocol: "https", hostname: "image.tmdb.org" },
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"dev:keys": "tsx scripts/make-test-keys.ts",
"db:export": "tsx scripts/export-dump.ts",
"db:import": "tsx scripts/import-dump.ts",
"db:studio": "drizzle-kit studio"
"db:studio": "drizzle-kit studio",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@auth/drizzle-adapter": "^1.11.2",
"@vercel/analytics": "^2.0.1",
"dotenv": "^17.4.2",
"drizzle-orm": "^0.45.2",
"next": "16.2.9",
"next-auth": "5.0.0-beta.31",
Expand All @@ -43,13 +44,16 @@
"@types/pg": "^8.20.0",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@types/supertest": "^7.2.0",
"drizzle-kit": "^0.31.10",
"eslint": "^9.39.4",
"eslint-config-next": "16.2.9",
"postcss": "^8.5.6",
"supertest": "^7.2.2",
"tailwindcss": "^4.3.1",
"tsx": "^4.22.4",
"typescript": "^6.0.3"
"typescript": "^6.0.3",
"vitest": "^4.1.9"
},
"packageManager": "pnpm@11.9.0"
}
Loading