Skip to content

Commit 5d52db4

Browse files
Lms24cursoragent
andcommitted
test(browser): Fix session test lint error and debug message order
Replace the inline `import()` type annotation in the browserSession unit test with a top-level type import to satisfy `consistent-type-imports`. Reorder the expected logs in the debug integration test: now that the initial session capture is deferred, the "Discarded session" warning is emitted after the `BrowserSession` integration is installed rather than before it. Co-Authored-By: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d183039 commit 5d52db4

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

dev-packages/browser-integration-tests/suites/public-api/debug/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ sentryTest('logs debug messages correctly', async ({ getLocalTestUrl, page }) =>
3434
'Sentry Logger [log]: Integration installed: Dedupe',
3535
'Sentry Logger [log]: Integration installed: HttpContext',
3636
'Sentry Logger [log]: Integration installed: CultureContext',
37-
'Sentry Logger [warn]: Discarded session because of missing or non-string release',
3837
'Sentry Logger [log]: Integration installed: BrowserSession',
38+
'Sentry Logger [warn]: Discarded session because of missing or non-string release',
3939
'test log',
4040
]
4141
: ['[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.', 'test log'],

packages/browser/test/integrations/browsersession.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @vitest-environment jsdom
33
*/
44

5+
import type * as BrowserUtils from '@sentry/browser-utils';
56
import type { Scope, User } from '@sentry/core/browser';
67
import * as SentryCore from '@sentry/core/browser';
78
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -24,7 +25,7 @@ vi.mock('@sentry/core/browser', async importActual => {
2425
// Capture the registered history handler so navigation can be driven deterministically,
2526
// while keeping the real `whenIdleOrHidden` (the tests drive its timers/events directly).
2627
vi.mock('@sentry/browser-utils', async importActual => {
27-
const actual = (await importActual()) as typeof import('@sentry/browser-utils');
28+
const actual = (await importActual()) as typeof BrowserUtils;
2829
return {
2930
...actual,
3031
addHistoryInstrumentationHandler: (handler: (data: { from?: string; to?: string }) => void) => {

0 commit comments

Comments
 (0)