typeorm-transactional-tests
v2.0.0
Published
[](https://app.travis-ci.com/github/viniciusjssouza/typeorm-transactional-tests) [ => {
connection = getConnection();
transactionalContext = new TransactionalTestContext(connection);
await transactionalContext.start();
});
afterEach(async () => {
await transactionalContext.finish();
});Also, it is possible to apply the context to all your tests using a global Jest setup file. Add a new file on your test folder:
import TransactionalTestContext from 'typeorm-transactional-tests'
// @ts-ignore
global.beforeEach(async () => await transactionalContext.start());
// @ts-ignore
global.afterEach(async () => await transactionalContext.finish());And point the Jest configuration to it:
"setupFilesAfterEnv": [
"<rootDir>/test/support/transactionalContext.ts"
]