Skip to content
Discussion options

You must be logged in to vote

Hello,

We are in the process of updating Adonis to use the latest version of Japa. I want to create a global transaction at the beginning and a rollback at the end of the tests (and not in each test suite or group because some tests use data from other tests, they are not independent between them).

Before, in our japaFile.ts we had :

async function setupDatabase() {
  /** BEGIN GLOBAL TRANSACTION **/
  const { default: Database } = await import('@ioc:Adonis/Lucid/Database')
  await Database.beginGlobalTransaction('pg')
}

async function rollbackDatabase() {
  /** ROLLBACK GLOBAL TRANSACTION **/
  const { default: Database } = await import('@ioc:Adonis/Lucid/Database')
  await Database.ro…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kamilcglr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant