Skip to content

Commit

Permalink
fix deno tests by normalizing lineno and colno in event snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Apr 10, 2024
1 parent 5a7e1a9 commit ac16c58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/deno/test/__snapshots__/mod.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,47 @@ snapshot[`captureException 1`] = `
stacktrace: {
frames: [
{
colno: 20,
colno: "{{colno}}",
filename: "ext:cli/40_testing.js",
function: "outerWrapped",
in_app: false,
lineno: 472,
lineno: "{{lineno}}",
},
{
colno: 33,
colno: "{{colno}}",
filename: "ext:cli/40_testing.js",
function: "exitSanitizer",
in_app: false,
lineno: 458,
lineno: "{{lineno}}",
},
{
colno: 31,
colno: "{{colno}}",
filename: "ext:cli/40_testing.js",
function: "resourceSanitizer",
in_app: false,
lineno: 410,
lineno: "{{lineno}}",
},
{
colno: 33,
colno: "{{colno}}",
filename: "ext:cli/40_testing.js",
function: "asyncOpSanitizer",
in_app: false,
lineno: 177,
lineno: "{{lineno}}",
},
{
colno: 11,
colno: "{{colno}}",
filename: "ext:cli/40_testing.js",
function: "innerWrapped",
in_app: false,
lineno: 526,
lineno: "{{lineno}}",
},
{
colno: 27,
colno: "{{colno}}",
context_line: " client.captureException(something());",
filename: "app:///test/mod.test.ts",
function: "<anonymous>",
in_app: true,
lineno: 47,
lineno: "{{lineno}}",
post_context: [
"",
" await delay(200);",
Expand All @@ -103,12 +103,12 @@ snapshot[`captureException 1`] = `
],
},
{
colno: 12,
colno: "{{colno}}",
context_line: " return new Error('Some unhandled error');",
filename: "app:///test/mod.test.ts",
function: "something",
in_app: true,
lineno: 44,
lineno: "{{lineno}}",
post_context: [
" }",
"",
Expand Down
7 changes: 7 additions & 0 deletions packages/deno/test/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ function normalizeEvent(event: sentryTypes.Event): sentryTypes.Event {
event.exception.values[0].stacktrace.frames = event.exception.values[0].stacktrace.frames.filter(
frame => !frame.filename?.includes('deno:'),
);

// @ts-expect-error - we're setting a string as lineno/colno for normalization
event.exception.values[0].stacktrace.frames = event.exception.values[0].stacktrace.frames.map(frame => ({
...frame,
lineno: '{{lineno}}',
colno: '{{colno}}',
}));
}

event.timestamp = 0;
Expand Down

0 comments on commit ac16c58

Please sign in to comment.