typeorm-test-transactions
Version:
A transactional wrapper for tests that use TypeORM that automatically rolls back the transaction at the end of the test.
17 lines • 799 B
TypeScript
export declare type RunFunction = () => Promise<void> | void;
/**
* Runs the code in a transaction and runs rollback on the transaction at the
* end of it.
* @param func The function you want run in a transaction
*/
export declare function runInTransaction(func: RunFunction): () => Promise<void>;
/**
* Runs a function in a nested transaction for each connection specified
* @param connections The connections to run the transactions in
* @param func The function you want run in a transaction
*
* Thanks @Dzeri96 for this contribution
* https://github.com/Dzeri96/typeorm-test-transactions/tree/nested-transactions
*/
export declare function runInMultiConnectionTransaction(connections: string[], func: RunFunction): () => Promise<void>;
//# sourceMappingURL=run-in-transaction.d.ts.map