Open moltar opened 4 years ago
I'm "successfully" using it like this:
import { TransactionalTestContext } from 'typeorm-transactional-tests';
import { getConnection } from 'typeorm';
let transactionalContext: TransactionalTestContext;
let connection;
global.beforeEach(async () => {
connection = getConnection();
transactionalContext = new TransactionalTestContext(connection);
transactionalContext.start();
});
But I don't see how that should make any difference though.
I think it could be typeorm
version difference. Maybe they modified the connection object signature and it no longer matches what is expected in typeorm-transactional-tests
.
That's what I thought too initially. But I got the same, or very similar error message as you.
I'm new to Typescript, but I'm thinking the let connection;
matters. As opposed to doing let connection: Connection;
. Which is what might happen when you declare it as const connection = getConnection();
.
There's also this: https://github.com/entrostat/typeorm-test-transactions#readme
Thanks for that link. I've seen it already, it has a flaw that it does not allow customized connection.
Connection is marked as depreciated FYI
Code Sample
Type Error
Error Message