So I've written plenty of e2e tests for my backend and this is becoming overwhelming as all of test methods are in one file.
Reason I have all of them in one file is that when my app is created, TypeORM creates in-memory database instance on which I do all of the tests - I need same database to be running across tests as I am doing cross-entities tests.
This part of code is crucial. It initializes app (which also initializes db under the hood):
let app: INestApplication;
beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
Is there a way to somehow transfer beforeAll()'s context so that it could be accessed from tests located in other files?
Maybe somehow make app global?