From bab51cd428ccf297e6624efbfa40894c51c8cec7 Mon Sep 17 00:00:00 2001 From: caelum0x Date: Sun, 6 Sep 2026 12:13:32 +0300 Subject: [PATCH] test(backend): exclude e2e suite from default jest run The default jest.config.js matched tests/e2e/*.e2e.test.ts, which are meant to run only under jest.e2e.config.js against a real Postgres + Redis (npm run test:e2e). Running them under the default (mocked) config made the parallel suite non-deterministic: posts.e2e and snippets.e2e collided on shared DB state and intermittently failed, while passing in isolation/serial. Add testPathIgnorePatterns for tests/e2e so the default unit/integration run is deterministic and needs no Docker datastores. The e2e suite still runs via its own config. Default suite now green in parallel (57 suites / 1434 tests). Co-Authored-By: Claude Fable 5 --- gitgram/backend/jest.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gitgram/backend/jest.config.js b/gitgram/backend/jest.config.js index d2397cee..b7b93640 100644 --- a/gitgram/backend/jest.config.js +++ b/gitgram/backend/jest.config.js @@ -3,6 +3,12 @@ module.exports = { testEnvironment: 'node', roots: ['/src', '/tests'], testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'], + // The end-to-end suite (tests/e2e/*.e2e.test.ts) runs the REAL Express app + // against a REAL Postgres + Redis and has its own config (jest.e2e.config.js, + // run via `npm run test:e2e`). Excluding it here keeps the default unit / + // integration run deterministic — it must not require Docker datastores and + // must not collide on ports when run in parallel. + testPathIgnorePatterns: ['/node_modules/', '/tests/e2e/'], transform: { '^.+\\.ts$': ['ts-jest', { diagnostics: false }], },