[object Object]

← back to AbramsOS

fix(tests): isolate suite to abrams_os_test DB

ab337c2ff1bd77f12181c3b64267f95ae80e5f6f · 2026-07-07 08:01:02 -0700 · Steve

pretest builds/migrates/seeds a throwaway abrams_os_test (schema + all migrations
+ seed.sql + rights-rules); test script pins PG_DATABASE=abrams_os_test. Stops the
auth-e2e test from wiping the real owner account on every `npm test` (AGENTS.md rule).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit ab337c2ff1bd77f12181c3b64267f95ae80e5f6f
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 7 08:01:02 2026 -0700

    fix(tests): isolate suite to abrams_os_test DB
    
    pretest builds/migrates/seeds a throwaway abrams_os_test (schema + all migrations
    + seed.sql + rights-rules); test script pins PG_DATABASE=abrams_os_test. Stops the
    auth-e2e test from wiping the real owner account on every `npm test` (AGENTS.md rule).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 package.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 762857b..76ae987 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,8 @@
   "scripts": {
     "start": "node server.js",
     "dev": "nodemon server.js",
-    "test": "node --test tests/*.test.js",
+    "pretest": "createdb abrams_os_test 2>/dev/null || true; psql -q -d abrams_os_test -f db/schema.sql >/dev/null 2>&1 || true; for m in db/migrations/*.sql; do psql -q -d abrams_os_test -f \"$m\" >/dev/null 2>&1 || true; done; psql -q -d abrams_os_test -f db/seed.sql >/dev/null 2>&1 || true; PG_DATABASE=abrams_os_test node scripts/seed-rights-rules.js >/dev/null 2>&1 || true",
+    "test": "PG_DATABASE=abrams_os_test node --test tests/*.test.js",
     "migrate": "psql -d abrams_os -f db/schema.sql",
     "seed": "psql -d abrams_os -f db/seed.sql"
   },

← 3a31291 feat(digest): suppress zero-deadline days  ·  back to AbramsOS  ·  feat(health): Household (people/spouse) + Medications with F 63d53f9 →