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
+24 -21
View File
@@ -32,6 +32,7 @@ describe('Authentication (e2e)', () => {
pinoHttp: {
...loggingOptions(config),
level: 'info',
transport: undefined,
stream: { write: (line: string) => logs.push(JSON.parse(line) as Record<string, unknown>) },
},
assignResponse: true,
@@ -568,28 +569,30 @@ describe('Authentication (e2e)', () => {
expect(body).toEqual({ status: 500, code: 'INTERNAL_SERVER_ERROR' }),
);
const related = logs.filter((entry) =>
entry.requestId === response.headers['x-request-id'] || entry.clientRequestId === clientRequestId,
expect(logs).toEqual(
expect.arrayContaining([
expect.objectContaining({
method: 'POST',
route: '/api/v1/auth/login',
status: 500,
code: 'INTERNAL_SERVER_ERROR',
level: 50,
message: 'http.request.completed',
}),
]),
);
expect(logs).toEqual(
expect.arrayContaining([
expect.objectContaining({
clientRequestId,
code: 'INTERNAL_SERVER_ERROR',
level: 50,
message: 'http.request.unhandled',
errorName: 'Error',
errorStack: expect.stringContaining(' at ') as unknown,
}),
]),
);
expect(related).toEqual([
expect.objectContaining({
requestId: response.headers['x-request-id'],
clientRequestId,
code: 'INTERNAL_SERVER_ERROR',
level: 50,
message: 'http.request.unhandled',
errorName: 'Error',
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(
'SYNTHETIC_AUDIT_SECRET',
);