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 <noreply@anthropic.com>
This commit is contained in:
caelum0x 2026-09-06 12:13:32 +03:00
parent 7589058b91
commit bab51cd428

View File

@ -3,6 +3,12 @@ module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/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/', '<rootDir>/tests/e2e/'],
transform: {
'^.+\\.ts$': ['ts-jest', { diagnostics: false }],
},