mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Bulk rename across 989 files: - Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc. - Repository URLs: posthog/posthog-js → hanzoai/insights-js - Brand names: PostHog → Insights - File renames: 259 reference JSON files, source files, workflow files - Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import { expect } from '../utils/insights-playwright-test-base'
|
|
import { test } from '../../fixtures'
|
|
|
|
test.describe('ErrorTracking chunkIds', () => {
|
|
test.use({
|
|
url: '/playground/cypress/index.html',
|
|
})
|
|
|
|
test('chunk ids are added to frames when present', async ({ events, page, insights }) => {
|
|
await insights.init()
|
|
const chunkId = '1234'
|
|
await page.route(`https://errortracking.com/script.js`, async (route) => {
|
|
await route.fulfill({
|
|
headers: { loaded: 'using relative path by playwright' },
|
|
contentType: 'application/javascript',
|
|
body: `
|
|
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._insightsChunkIds=e._insightsChunkIds||{},e._insightsChunkIds[n]="${chunkId}")}catch(e){}}();
|
|
const error = new Error('this is an error')
|
|
window.insights.captureException(error)
|
|
`,
|
|
})
|
|
})
|
|
await page.addScriptTag({
|
|
type: 'module',
|
|
url: 'https://errortracking.com/script.js',
|
|
})
|
|
const exception = await events.waitForEvent('$exception')
|
|
expect(exception.properties.$exception_list).toHaveLength(1)
|
|
expect(exception.properties.$exception_list[0].stacktrace.frames).toHaveLength(1)
|
|
expect(exception.properties.$exception_list[0].stacktrace.frames[0].chunk_id).toEqual(chunkId)
|
|
})
|
|
})
|