Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
split out teardown into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneJeon committed Dec 20, 2021
1 parent 954a1b6 commit 93cf4b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ module.exports = {
notify: true,
globalSetup: './tests/utils/setup-db.js',
globalTeardown: './tests/utils/teardown-db.js',
setupFilesAfterEnv: ['./tests/utils/trxify-tests.js']
setupFilesAfterEnv: [
'./tests/utils/trxify-tests.js',
'./tests/utils/teardown-db.js'
]
}
5 changes: 5 additions & 0 deletions tests/utils/teardown-db.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const knex = require('./knex')

if (typeof afterAll !== 'undefined')
afterAll(async () => {
await knex.destroy()
})

module.exports = async () => {
await knex.destroy()
}
4 changes: 0 additions & 4 deletions tests/utils/trxify-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ afterEach(done => {
afterDone = done
BaseModel.knex().rollback()
})

afterAll(async () => {
await knex.destroy()
})

0 comments on commit 93cf4b5

Please sign in to comment.