From 3f27cb6d1cb4fb25584939533f45a277289f4dc6 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Sun, 19 Nov 2023 00:03:38 +0100 Subject: [PATCH] fix: wrong stacktrace type --- __tests__/commonTests.ts | 5 ++++- browser.d.ts | 4 ++-- docs/api/reportError.md | 4 ++-- src/types.ts | 4 ++-- website/docs/api/types.md | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/__tests__/commonTests.ts b/__tests__/commonTests.ts index 0ac9266..45f8726 100644 --- a/__tests__/commonTests.ts +++ b/__tests__/commonTests.ts @@ -77,12 +77,15 @@ export function createCommonTests({ await waitForExpect(() => expect(testkit.reports()).toHaveLength(1)) }) - test('should have an error object with the captured exception', async function() { + test('should have an error object with the captured exception and stacktrace', async function() { Sentry.captureException(new Error('sentry test kit is awesome!')) await waitForExpect(() => expect(testkit.reports()).toHaveLength(1)) expect(testkit.reports()[0]!.error).toMatchObject({ name: 'Error', message: 'sentry test kit is awesome!', + stacktrace: { + frames: expect.any(Array), + }, }) }) diff --git a/browser.d.ts b/browser.d.ts index 61bd907..9bbd47a 100644 --- a/browser.d.ts +++ b/browser.d.ts @@ -3,7 +3,7 @@ import { Breadcrumb, User, SeverityLevel, - StackFrame, + Stacktrace, Transport, } from '@sentry/types' @@ -22,7 +22,7 @@ declare namespace sentryTestkit { interface ReportError { name: string message: string - stacktrace: StackFrame[] + stacktrace: Stacktrace } interface Report { diff --git a/docs/api/reportError.md b/docs/api/reportError.md index d5e727f..ac888db 100644 --- a/docs/api/reportError.md +++ b/docs/api/reportError.md @@ -6,5 +6,5 @@ The error name #### `message` [string] The error message -#### `stacktrace` [[StackFrame[]](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stackframe.ts)] -The error stacktrace as individual frames \ No newline at end of file +#### `stacktrace` [[Stacktrace[]](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stacktrace.ts)] +The error stacktrace as individual frames diff --git a/src/types.ts b/src/types.ts index 4be6b48..f05d06d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,7 +3,7 @@ import { Breadcrumb, User, SeverityLevel, - StackFrame, + Stacktrace, Transport, } from '@sentry/types' @@ -22,7 +22,7 @@ declare namespace sentryTestkit { interface ReportError { name: string message: string - stacktrace: StackFrame[] + stacktrace: Stacktrace } interface Report { diff --git a/website/docs/api/types.md b/website/docs/api/types.md index c30a096..fc72bc1 100644 --- a/website/docs/api/types.md +++ b/website/docs/api/types.md @@ -13,10 +13,10 @@ Represents a report error object. The object has the following keys: //The error message message: string // The error stacktrace as individual frames - stacktrace: StackFrame[] + stacktrace: Stacktrace } ``` -**See:** [StackFrame](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stackframe.ts) +**See:** [Stacktrace](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stacktrace.ts) ### `Report`