fix: resolve test hang issues in CI

- Fixed MSW event listener memory leaks
- Added proper database connection cleanup
- Fixed MSW server lifecycle management
- Reduced global test timeout to 30s for faster failure detection
- Added resource cleanup in all integration tests

This should resolve the GitHub Actions test hanging issue
This commit is contained in:
czlonkowski
2025-07-29 13:07:51 +02:00
parent c824fb5ebf
commit 115bb6f36c
5 changed files with 88 additions and 25 deletions

View File

@@ -50,13 +50,21 @@ describe('MSW Setup Verification', () => {
});
describe('Integration Test Server', () => {
let serverStarted = false;
beforeAll(() => {
// Start a separate MSW instance for more control
mswTestServer.start({ onUnhandledRequest: 'error' });
// Only start if not already running
if (!serverStarted) {
mswTestServer.start({ onUnhandledRequest: 'error' });
serverStarted = true;
}
});
afterAll(() => {
mswTestServer.stop();
if (serverStarted) {
mswTestServer.stop();
serverStarted = false;
}
});
it('should handle workflow creation with custom response', async () => {
@@ -163,7 +171,7 @@ describe('MSW Setup Verification', () => {
expect(requests).toHaveLength(2);
expect(requests[0].url).toContain('/api/v1/workflows');
expect(requests[1].url).toContain('/api/v1/executions');
});
}, { timeout: 10000 }); // Increase timeout for this specific test
it('should work with scoped handlers', async () => {
const result = await mswTestServer.withScope(