To run the tests on PostgreSQL instead of the default SQLite, first setup the test database analogously to local run as identical to deployment as possible:and then run with:Run only matching tests on PostgreSQL:
cd web
bin/pg-setup ourbigbook_testnpm run test-pgnpm run test-pg -- -g 'substring of test title'Running tests erases all data present in the database used. In order to point to a custom database use:We don't use
DATABASE_URL_TEST=postgres://realworld_next_user:a@localhost:5432/realworld_next_test npm run test-pgDATABASE_URL when running tests as a safeguard to reduce the likelihood of accidentally nuking the production database.The test database contains the state of the latest test run at the end of the run. You can inspect it with web/bin/psql with:
bin/psql -d ourbigbook_test