Skip to content

Commit

Permalink
👌 improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-lebeau committed Jan 31, 2025
1 parent 155a83b commit 07fc44b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/e2e/scenario/logs.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.describe('logs', () => {
expect(intakeRegistry.logsEvents).toHaveLength(1)
expect(intakeRegistry.logsEvents[0].message).toBe('oh snap')
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand Down Expand Up @@ -155,7 +155,7 @@ test.describe('logs', () => {
flushBrowserLogs()
await flushEvents()

expect(intakeRegistry.logsEvents.length).toEqual(2)
expect(intakeRegistry.logsEvents).toHaveLength(2)

const unreachableRequest = intakeRegistry.logsEvents.find((log) => log.http!.url.includes('/unreachable'))!
const throwRequest = intakeRegistry.logsEvents.find((log) => log.http!.url.includes('/throw'))!
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/scenario/rum/actions.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ test.describe('action collection', () => {
expect(intakeRegistry.rumViewEvents[0].view.frustration!.count).toBe(1)

withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand Down Expand Up @@ -411,7 +411,7 @@ test.describe('action collection', () => {
expect(intakeRegistry.rumViewEvents[0].view.frustration!.count).toBe(2)

withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand Down
12 changes: 6 additions & 6 deletions test/e2e/scenario/rum/errors.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.describe('rum errors', () => {
handling: 'handled',
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand All @@ -57,7 +57,7 @@ test.describe('rum errors', () => {
handling: 'handled',
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand All @@ -77,7 +77,7 @@ test.describe('rum errors', () => {
handling: 'unhandled',
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand All @@ -97,7 +97,7 @@ test.describe('rum errors', () => {
handling: 'unhandled',
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})

Expand All @@ -118,7 +118,7 @@ test.describe('rum errors', () => {
handling: 'handled',
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(0)
expect(browserLogs).toHaveLength(0)
})
})

Expand Down Expand Up @@ -158,7 +158,7 @@ test.describe('rum errors', () => {
},
})
withBrowserLogs((browserLogs) => {
expect(browserLogs.length).toEqual(1)
expect(browserLogs).toHaveLength(1)
})
})
})
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/scenario/rum/init.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ test.describe('API calls and events around init', () => {
;(window.DD_RUM! as unknown as { init(): void }).init()
})
.run(({ withBrowserLogs }) => {
expect([1, 2, 3]).toHaveLength(1)

withBrowserLogs((logs) => {
expect(logs).toHaveLength(1)
expect(logs[0].message).toEqual(expect.stringContaining('Datadog Browser SDK'))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/scenario/rum/resources.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ test.describe('rum resources', () => {
await flushEvents()

const resourceEvents = intakeRegistry.rumResourceEvents.filter((event) => event.resource.type === 'xhr')
expect(resourceEvents.length).toEqual(2)
expect(resourceEvents).toHaveLength(2)
expect(intakeRegistry.rumErrorEvents).toHaveLength(0)
expect(resourceEvents[0].resource.url).toContain('/ok?duration=100&call=1')
expect(resourceEvents[0].resource.status_code).toEqual(200)
Expand Down

0 comments on commit 07fc44b

Please sign in to comment.