Skip to content

Commit 1182786

Browse files
committed
improve integration test
1 parent f3b1f37 commit 1182786

File tree

1 file changed

+5
-7
lines changed
  • packages/browser-integration-tests/suites/integrations/ContextLines

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { sentryTest } from '../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
66

77
sentryTest(
8-
'should add source context lines around stack frames from errors in Html',
8+
'should add source context lines around stack frames from errors in Html inline JS',
99
async ({ getLocalTestPath, page }) => {
1010
const url = await getLocalTestPath({ testDir: __dirname });
1111

1212
const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);
1313

14-
await page.click('#inline-error-btn');
14+
const clickPromise = page.click('#inline-error-btn');
1515

16-
const eventData = await eventPromise;
16+
const [eventData] = await Promise.all([eventPromise, clickPromise]);
1717

1818
expect(eventData.exception?.values).toHaveLength(1);
1919

@@ -23,14 +23,12 @@ sentryTest(
2323
stacktrace: {
2424
frames: [
2525
{
26-
colno: 97,
27-
lineno: 7,
2826
pre_context: [' <meta charset="utf-8">', ' </head>', ' <body>'],
2927
context_line:
3028
' <button id="inline-error-btn" onclick="throw new Error(\'Error with context lines\')">Click me</button>',
3129
post_context: [
3230
' <button id="script-error-btn">Click me too</button>',
33-
' <script defer="" src="init.bundle.js"></script><script defer="" src="subject.bundle.js"></script>',
31+
expect.stringContaining('subject.bundle.js'), // this line varies in the test based on tarball/cdn bundle (+variants)
3432
' <footer>',
3533
],
3634
},
@@ -40,7 +38,7 @@ sentryTest(
4038
},
4139
);
4240

43-
sentryTest('should not add source context lines to errors from scripts', async ({ getLocalTestPath, page }) => {
41+
sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestPath, page }) => {
4442
const url = await getLocalTestPath({ testDir: __dirname });
4543

4644
const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);

0 commit comments

Comments
 (0)