Skip to content

Commit fda28e8

Browse files
author
cod1k
committed
Fix possible undefined access in error test assertions
Updated the test to safely handle potential undefined values in the stacktrace frames. This prevents runtime errors during test execution and ensures robust validation of error handling logic.
1 parent 2346b82 commit fda28e8

File tree

1 file changed

+2
-2
lines changed
  • dev-packages/e2e-tests/test-applications/node-express/tests

1 file changed

+2
-2
lines changed

dev-packages/e2e-tests/test-applications/node-express/tests/errors.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ test('Should record caught exceptions with local variable', async ({ baseURL })
3737

3838
const errorEvent = await errorEventPromise;
3939

40-
const frames = errorEvent.exception?.values?.[0].stacktrace?.frames;
41-
expect(frames?.[frames.length - 1].vars?.randomVariableToRecord).toBeDefined();
40+
const frames = errorEvent.exception?.values?.[0]?.stacktrace?.frames;
41+
expect(frames?.[frames.length - 1]?.vars?.randomVariableToRecord).toBeDefined();
4242
});

0 commit comments

Comments
 (0)