Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/domain/bufferedData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('startBufferingData', () => {
})

it('collects console logs', (done) => {
spyOn(console, 'error').and.callFake(noop)
const { observable, stop } = startBufferingData()

registerCleanupTask(() => {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/domain/session/sessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
timeStampNow,
} from '../../tools/utils/timeUtils'
import { addEventListener, addEventListeners, DOM_EVENT } from '../../browser/addEventListener'
import { startLifecycleTracker } from '../../browser/lifecycleTracker'
import { resetLifecycleTracker, startLifecycleTracker } from '../../browser/lifecycleTracker'
import { clearInterval, clearTimeout, setInterval, setTimeout } from '../../tools/timer'
import { mockable } from '../../tools/mockable'
import { noop, throttle } from '../../tools/utils/functionUtils'
Expand Down Expand Up @@ -373,6 +373,7 @@ export function startSessionManagerStub(): Promise<SessionManager> {
export function stopSessionManager() {
stopCallbacks.forEach((e) => e())
stopCallbacks = []
resetLifecycleTracker()
}

function trackActivity(configuration: Configuration, expandOrRenewSession: () => void) {
Expand Down
3 changes: 2 additions & 1 deletion packages/debugger/src/domain/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Probe } from './probes'

describe('api', () => {
let mockBatchAdd: jasmine.Spy
let warnSpy: jasmine.Spy

function initTransport(overrides: Record<string, unknown> = {}) {
resetDebuggerTransport()
Expand All @@ -20,6 +21,7 @@ describe('api', () => {
beforeEach(() => {
clearProbes()

warnSpy = spyOn(display, 'warn')
mockBatchAdd = jasmine.createSpy('batchAdd')
initTransport()
;(window as any).DD_DEBUGGER = {
Expand Down Expand Up @@ -1135,7 +1137,6 @@ describe('api', () => {

it('should handle uninitialized debugger transport gracefully', () => {
resetDebuggerTransport()
const warnSpy = spyOn(display, 'warn')

const probe: Probe = {
id: 'test-probe',
Expand Down
8 changes: 4 additions & 4 deletions packages/debugger/src/domain/deliveryApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ describe('buildDeliveryApiUrl', () => {

describe('deliveryApi', () => {
let fetchSpy: jasmine.Spy
let errorSpy: jasmine.Spy
let warnSpy: jasmine.Spy
let clock: Clock

function makeConfig(overrides: Partial<DeliveryApiConfiguration> = {}): DeliveryApiConfiguration {
Expand Down Expand Up @@ -100,6 +102,8 @@ describe('deliveryApi', () => {
clearProbes()
clearDeliveryApiState()
fetchSpy = spyOn(window, 'fetch')
errorSpy = spyOn(display, 'error')
warnSpy = spyOn(display, 'warn')
respondWith({ nextCursor: '', updates: [], deletions: [] })

registerCleanupTask(() => {
Expand Down Expand Up @@ -159,7 +163,6 @@ describe('deliveryApi', () => {
})

it('should warn if polling is already started', () => {
const warnSpy = spyOn(display, 'warn')
startDeliveryApiPolling(makeConfig())
startDeliveryApiPolling(makeConfig())

Expand Down Expand Up @@ -253,7 +256,6 @@ describe('deliveryApi', () => {
})

it('should log an error when the response is not ok', async () => {
const errorSpy = spyOn(display, 'error')
respondWith({}, 500)

startDeliveryApiPolling(makeConfig())
Expand All @@ -263,7 +265,6 @@ describe('deliveryApi', () => {
})

it('should log an error when fetch throws', async () => {
const errorSpy = spyOn(display, 'error')
fetchSpy.and.returnValue(Promise.reject(new Error('network error')))

startDeliveryApiPolling(makeConfig())
Expand Down Expand Up @@ -552,7 +553,6 @@ describe('deliveryApi', () => {
})

it('should warn when tripping', async () => {
const warnSpy = spyOn(display, 'warn')
respondWithNetworkError()
startDeliveryApiPolling(makeConfig({ pollInterval: POLL_INTERVAL_MS }))
await flushPromises()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ describe('serializeDOMAttributes', () => {
{ html: '<div href="value">', expectedBehavior: 'always-unmasked' },
{ html: '<iframe srcdoc="value">', expectedBehavior: 'maskable' },
{ html: '<div srcdoc="value">', expectedBehavior: 'always-unmasked' },
{ html: '<img src="value">', expectedBehavior: 'maskable-image' },
{ html: '<img srcset="value">', expectedBehavior: 'maskable-image' },
{ html: '<source src="value">', expectedBehavior: 'maskable-image' },
{ html: '<source srcset="value">', expectedBehavior: 'maskable-image' },
{ html: '<img src="data:image/gif;base64,R0lGODlhAQABAAAAACw=">', expectedBehavior: 'maskable-image' },
{ html: '<img srcset="data:image/gif;base64,R0lGODlhAQABAAAAACw= 1x">', expectedBehavior: 'maskable-image' },
{ html: '<source src="data:image/gif;base64,R0lGODlhAQABAAAAACw=">', expectedBehavior: 'maskable-image' },
{ html: '<source srcset="data:image/gif;base64,R0lGODlhAQABAAAAACw= 1x">', expectedBehavior: 'maskable-image' },
{ html: '<div src="value">', expectedBehavior: 'always-unmasked' },
{ html: '<div srcset="value">', expectedBehavior: 'always-unmasked' },

Expand Down
Loading