Replies: 1 comment
-
In the doc, in the tests it is indicated to return a promise in setup https://docs.adonisjs.com/guides/testing/introduction#global-transactions so I did : export const runnerHooks: Required<Pick<Config, 'setup' | 'teardown'>> = {
setup: [
() => TestUtils.ace().loadCommands(),
async () => {
await Database.beginGlobalTransaction()
return () => Database.rollbackGlobalTransaction()
},
],
teardown: [],
} and it seems to work |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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 :
So now I try to put the following code in the bootstrap.ts file
I have two problems:
1 - Is this the right way to do it?
2 - It seems that the function in teardown is never called. So the tests never finish.
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions