|
| 1 | +import { expect } from '@playwright/test'; |
| 2 | +import { Event } from '@sentry/types'; |
| 3 | + |
| 4 | +import { sentryTest } from '../../../utils/fixtures'; |
| 5 | +import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; |
| 6 | + |
| 7 | +sentryTest( |
| 8 | + 'should parse function identifiers that contain protocol names correctly', |
| 9 | + async ({ getLocalTestPath, page, runInChromium, runInFirefox, runInWebkit }) => { |
| 10 | + const url = await getLocalTestPath({ testDir: __dirname }); |
| 11 | + |
| 12 | + const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url); |
| 13 | + const frames = eventData.exception?.values?.[0].stacktrace?.frames; |
| 14 | + |
| 15 | + runInChromium(() => { |
| 16 | + expect(frames).toMatchObject([ |
| 17 | + { function: '?' }, |
| 18 | + { function: '?' }, |
| 19 | + { function: 'decodeBlob' }, |
| 20 | + { function: 'readFile' }, |
| 21 | + { function: 'httpsCall' }, |
| 22 | + { function: 'webpackDevServer' }, |
| 23 | + { function: 'Function.httpCode' }, |
| 24 | + ]); |
| 25 | + }); |
| 26 | + |
| 27 | + runInFirefox(() => { |
| 28 | + expect(frames).toMatchObject([ |
| 29 | + { function: '?' }, |
| 30 | + { function: '?' }, |
| 31 | + { function: 'decodeBlob' }, |
| 32 | + { function: 'readFile' }, |
| 33 | + { function: 'httpsCall' }, |
| 34 | + { function: 'webpackDevServer' }, |
| 35 | + { function: 'httpCode' }, |
| 36 | + ]); |
| 37 | + }); |
| 38 | + |
| 39 | + runInWebkit(() => { |
| 40 | + expect(frames).toMatchObject([ |
| 41 | + { function: 'global code' }, |
| 42 | + { function: '?' }, |
| 43 | + { function: 'decodeBlob' }, |
| 44 | + { function: 'readFile' }, |
| 45 | + { function: 'httpsCall' }, |
| 46 | + { function: 'webpackDevServer' }, |
| 47 | + { function: 'httpCode' }, |
| 48 | + ]); |
| 49 | + }); |
| 50 | + }, |
| 51 | +); |
| 52 | + |
| 53 | +sentryTest( |
| 54 | + 'should not add any part of the function identifier to beginning of filename', |
| 55 | + async ({ getLocalTestPath, page }) => { |
| 56 | + const url = await getLocalTestPath({ testDir: __dirname }); |
| 57 | + |
| 58 | + const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url); |
| 59 | + |
| 60 | + expect(eventData.exception?.values?.[0].stacktrace?.frames).toMatchObject( |
| 61 | + // specifically, we're trying to avoid values like `Blob@file://path/to/file` in frames with function names like `makeBlob` |
| 62 | + Array(7).fill({ filename: expect.stringMatching(/^file:\/?/) }), |
| 63 | + ); |
| 64 | + }, |
| 65 | +); |
0 commit comments