Skip to content

Commit 5a62315

Browse files
committed
test(types,core): name the cause-chain cases by their rule
Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1174c13 commit 5a62315

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/core/src/logger-error-cause.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('ObjectLogger — an error record carries the cause chain', () => {
8787
});
8888

8989
describe('a cause is redacted like the error', () => {
90-
it('withholds the named fields of a non-Error object cause, under the logger\'s own redact list', () => {
90+
it('under the logger\'s own redact list', () => {
9191
const chunks: string[] = [];
9292
vi.spyOn(process.stderr, 'write').mockImplementation(((chunk: unknown) => {
9393
chunks.push(String(chunk));
@@ -131,7 +131,7 @@ describe('parity — the logger and the fault log render one shape', () => {
131131
['a deep chain', deep],
132132
['a string cause', () => new Error('w', { cause: 'socket hang up' })],
133133
['an object cause', () => new Error('w', { cause: { code: 'ECONNRESET' } })],
134-
['an object cause with withheld fields', () => new Error('w', { cause: { code: 'E1', password: 'p', apiKey: 'k' } })],
134+
['a cause redacted like the error', () => new Error('w', { cause: { code: 'E1', password: 'p', apiKey: 'k' } })],
135135
['an object cause that cannot be serialized', () => {
136136
const loop: Record<string, unknown> = { code: 'E2' };
137137
loop.self = loop;

‎packages/types/src/server-fault-log-cause.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('faultCauseChain — bounded both ways', () => {
139139
});
140140

141141
describe('a cause is redacted like the error', () => {
142-
it('withholds the named fields of a non-Error object cause and keeps the rest', () => {
142+
it('an object cause', () => {
143143
const chain = faultCauseChain(withCause('w', { code: 'ECONNRESET', password: 'hunter2', apiKey: 'sk-live-1', nested: { authToken: 't-1' } }));
144144
expect(chain).toHaveLength(1);
145145
expect(JSON.parse(chain[0].message)).toEqual({
@@ -151,7 +151,7 @@ describe('a cause is redacted like the error', () => {
151151
for (const value of ['hunter2', 'sk-live-1', 't-1']) expect(chain[0].message).not.toContain(value);
152152
});
153153

154-
it('the console fallback line carries the withheld form', () => {
154+
it('on the console fallback line', () => {
155155
const spy = vi.spyOn(console, 'error').mockImplementation(() => {});
156156
try {
157157
logServerFault({ status: 500, error: withCause(OUTER, { password: 'hunter2' }) });

0 commit comments

Comments
 (0)