Open icbrg opened 6 months ago
Running into the same issue @Aliheym
EDIT: Looks like someone already figured this out.
I updated
jest.mock('typeorm-transactional', () => ({
Transactional: () => () => ({}),
}));
with
jest.mock("typeorm-transactional", () => ({
Transactional: () => () => ({}),
runOnTransactionCommit: () => () => ({}),
runOnTransactionRollback: () => () => ({}),
runOnTransactionComplete: () => () => ({}),
initializeTransactionalContext: () => ({}), // seems to be required for testing
}));
And my tests are passing :heavy_check_mark:
[x] NestJS [x] TypeORM
I have use jest to test function with Transactional decorator then I following these step to mock transaction for unit test mocking and get error from jest with message
No storage driver defined in your app ... please call initializeTransactionalContext() before application start.
Do anyone have any solution to resolve this issue?