test(logging): disable pretty transport in e2e stream (#120)
Backend verify / commits (pull_request) Successful in 30s
Backend verify / security (pull_request) Successful in 10s
Backend verify / verify (pull_request) Failing after 1m51s

This commit is contained in:
2026-10-24 14:54:23 +03:00
parent 678b456aa3
commit 5cf0efd813
+16 -13
View File
@@ -32,6 +32,7 @@ describe('Authentication (e2e)', () => {
pinoHttp: { pinoHttp: {
...loggingOptions(config), ...loggingOptions(config),
level: 'info', level: 'info',
transport: undefined,
stream: { write: (line: string) => logs.push(JSON.parse(line) as Record<string, unknown>) }, stream: { write: (line: string) => logs.push(JSON.parse(line) as Record<string, unknown>) },
}, },
assignResponse: true, assignResponse: true,
@@ -568,12 +569,21 @@ describe('Authentication (e2e)', () => {
expect(body).toEqual({ status: 500, code: 'INTERNAL_SERVER_ERROR' }), expect(body).toEqual({ status: 500, code: 'INTERNAL_SERVER_ERROR' }),
); );
const related = logs.filter((entry) => expect(logs).toEqual(
entry.requestId === response.headers['x-request-id'] || entry.clientRequestId === clientRequestId, expect.arrayContaining([
expect.objectContaining({
method: 'POST',
route: '/api/v1/auth/login',
status: 500,
code: 'INTERNAL_SERVER_ERROR',
level: 50,
message: 'http.request.completed',
}),
]),
); );
expect(related).toEqual([ expect(logs).toEqual(
expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
requestId: response.headers['x-request-id'],
clientRequestId, clientRequestId,
code: 'INTERNAL_SERVER_ERROR', code: 'INTERNAL_SERVER_ERROR',
level: 50, level: 50,
@@ -581,15 +591,8 @@ describe('Authentication (e2e)', () => {
errorName: 'Error', errorName: 'Error',
errorStack: expect.stringContaining(' at ') as unknown, errorStack: expect.stringContaining(' at ') as unknown,
}), }),
expect.objectContaining({ ]),
requestId: response.headers['x-request-id'], );
clientRequestId,
status: 500,
code: 'INTERNAL_SERVER_ERROR',
level: 50,
message: 'http.request.completed',
}),
]);
expect(JSON.stringify(logs)).not.toContain( expect(JSON.stringify(logs)).not.toContain(
'SYNTHETIC_AUDIT_SECRET', 'SYNTHETIC_AUDIT_SECRET',
); );