|
1 | 1 | import { expect, test } from '@playwright/test'; |
2 | 2 | import { waitForError } from '@sentry-internal/test-utils'; |
3 | 3 |
|
4 | | -test.describe('dev mode error symbolification', () => { |
5 | | - if (process.env.TEST_ENV !== 'development') { |
6 | | - test.skip('should be skipped for non-dev mode', () => {}); |
7 | | - return; |
8 | | - } |
| 4 | +test('should have symbolicated dev errors', async ({ page }) => { |
| 5 | + test.skip(process.env.TEST_ENV !== 'development', 'should be skipped for non-dev mode'); |
9 | 6 |
|
10 | | - test('should have symbolicated dev errors', async ({ page }) => { |
11 | | - await page.goto('/'); |
| 7 | + await page.goto('/'); |
12 | 8 |
|
13 | | - const errorEventPromise = waitForError('nextjs-app-dir', errorEvent => { |
14 | | - return errorEvent?.exception?.values?.[0]?.value === 'Click Error'; |
15 | | - }); |
| 9 | + const errorEventPromise = waitForError('nextjs-app-dir', errorEvent => { |
| 10 | + return errorEvent?.exception?.values?.[0]?.value === 'Click Error'; |
| 11 | + }); |
16 | 12 |
|
17 | | - await page.getByText('Throw error').click(); |
| 13 | + await page.getByText('Throw error').click(); |
18 | 14 |
|
19 | | - const errorEvent = await errorEventPromise; |
20 | | - const errorEventFrames = errorEvent.exception?.values?.[0]?.stacktrace?.frames; |
| 15 | + const errorEvent = await errorEventPromise; |
| 16 | + const errorEventFrames = errorEvent.exception?.values?.[0]?.stacktrace?.frames; |
21 | 17 |
|
22 | | - expect(errorEventFrames?.[errorEventFrames?.length - 1]).toEqual( |
23 | | - expect.objectContaining({ |
24 | | - function: 'onClick', |
25 | | - filename: 'components/client-error-debug-tools.tsx', |
26 | | - lineno: 54, |
27 | | - colno: expect.any(Number), |
28 | | - in_app: true, |
29 | | - pre_context: [' <button', ' onClick={() => {'], |
30 | | - context_line: " throw new Error('Click Error');", |
31 | | - post_context: [' }}', ' >', ' Throw error'], |
32 | | - }), |
33 | | - ); |
34 | | - }); |
| 18 | + expect(errorEventFrames?.[errorEventFrames?.length - 1]).toEqual( |
| 19 | + expect.objectContaining({ |
| 20 | + function: 'onClick', |
| 21 | + filename: 'components/client-error-debug-tools.tsx', |
| 22 | + lineno: 54, |
| 23 | + colno: expect.any(Number), |
| 24 | + in_app: true, |
| 25 | + pre_context: [' <button', ' onClick={() => {'], |
| 26 | + context_line: " throw new Error('Click Error');", |
| 27 | + post_context: [' }}', ' >', ' Throw error'], |
| 28 | + }), |
| 29 | + ); |
35 | 30 | }); |
0 commit comments