You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you'll need to start the reporter yourself, or create a custom test harness. I could probably add an event as well.
have a look at pta cli file if you want an example.
for your usecase, I usually wrap the default test function into a custom one which setup db and close it after each test.
It allows me for example to inject a custom db service which run every single test in an isolated transaction so that I can run all the tests concurrently.
here with pg
import{testasztest}from'zora';import{createDB}from'db';// my db abstractionimport{baseConfig,testDB}from'./_config.js';consttestClient=createDB({
...baseConfig,transactionMode: 'no-commit',database: testDB,allowExitOnIdle: true,max: 10,});exportconsttest=(description,specFn,options)=>// here you can wrap into a try finally to close/release the db connectionztest(description,(assert)=>specFn({ ...assert,db: testClient}),options);
and then I use this test function rather than zora's one
I know this is mostly intended for unit tests, but I also have some tests to run that do DB calls.
Is there a way to know when all async functions have completed as to close the DB connection so the test file can exit?
The text was updated successfully, but these errors were encountered: