Skip to content

Commit cb37c44

Browse files
committed
further integration test and doc improvements
1 parent 1182786 commit cb37c44

File tree

2 files changed

+23
-9
lines changed
  • packages

2 files changed

+23
-9
lines changed

packages/browser-integration-tests/suites/integrations/ContextLines/test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,29 @@ import { expect } from '@playwright/test';
22
import type { Event } from '@sentry/types';
33

44
import { sentryTest } from '../../../utils/fixtures';
5-
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
5+
import { envelopeRequestParser, getFirstSentryEnvelopeRequest, waitForErrorRequestOnUrl } from '../../../utils/helpers';
66

77
sentryTest(
88
'should add source context lines around stack frames from errors in Html inline JS',
9-
async ({ getLocalTestPath, page }) => {
9+
async ({ getLocalTestPath, page, browserName }) => {
10+
if (browserName === 'webkit') {
11+
// The error we're throwing in this test is thrown as "Script error." in Webkit.
12+
// We filter "Script error." out by default in `InboundFilters`.
13+
// I don't think there's much value to disable InboundFilters defaults for this test,
14+
// given that most of our users won't do that either.
15+
// Let's skip it instead for Webkit.
16+
sentryTest.skip();
17+
}
18+
1019
const url = await getLocalTestPath({ testDir: __dirname });
1120

12-
const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);
21+
const eventReqPromise = waitForErrorRequestOnUrl(page, url);
1322

1423
const clickPromise = page.click('#inline-error-btn');
1524

16-
const [eventData] = await Promise.all([eventPromise, clickPromise]);
25+
const [req] = await Promise.all([eventReqPromise, clickPromise]);
26+
27+
const eventData = envelopeRequestParser(req);
1728

1829
expect(eventData.exception?.values).toHaveLength(1);
1930

packages/browser/src/integrations/contextlines.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ interface ContextLinesOptions {
1414
}
1515

1616
/**
17-
* Collects source context lines around the line of a stackframe
18-
* This integration only works for stack frames pointing to JS that's directly embedded
19-
* in HTML files.
20-
* It DOES NOT work for stack frames pointing to JS files that are loaded by the browser.
21-
* For frames pointing to files, context lines are added during ingestino and symbolication
17+
* Collects source context lines around the line of a stackframe pointing to JS embedded in
18+
* the current page's HTML.
19+
*
20+
* Use this integration if you have inline JS code in HTML pages that can't be accessed
21+
* by our backend (e.g. due to a login-protected page).
22+
*
23+
* This integratino DOES NOT work for stack frames pointing to JS files that are loaded by the browser.
24+
* For frames pointing to files, context lines are added during ingestion and symbolication
2225
* by attempting to download the JS files to the Sentry backend.
2326
*/
2427
export class ContextLines implements Integration {

0 commit comments

Comments
 (0)