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:
cd web bin/pg-setup ourbigbook_test
Run only matching tests on PostgreSQL:
npm run test-pg
npm 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-pg
DATABASE_URLwhen 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