From 0b18707cc4e4d3c3c911c1078cbb55ae25fd7d8d Mon Sep 17 00:00:00 2001 From: Bastien Caudan <1331991+bcaudan@users.noreply.github.com> Date: Wed, 29 Mar 2023 10:05:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F[RUMF-1517]=20add=20test=20in?= =?UTF-8?q?dex=20files=20(#2115)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ♻️ add core/test/index * ♻️ add rum-core/test/index * ♻️ add rum/test/index --- .../core/src/browser/addEventListener.spec.ts | 2 +- .../core/src/browser/fetchObservable.spec.ts | 4 ++-- .../src/browser/pageExitObservable.spec.ts | 2 +- packages/core/src/browser/timer.spec.ts | 5 ++--- .../core/src/browser/xhrObservable.spec.ts | 2 +- .../configuration/endpointBuilder.spec.ts | 2 +- .../domain/report/reportObservable.spec.ts | 2 +- .../domain/session/sessionCookieStore.spec.ts | 2 +- .../src/domain/session/sessionManager.spec.ts | 4 ++-- .../src/domain/session/sessionStore.spec.ts | 4 ++-- .../synthetics/syntheticsWorkerValues.spec.ts | 2 +- .../domain/tracekit/computeStackTrace.spec.ts | 4 ++-- .../core/src/domain/tracekit/tracekit.spec.ts | 2 +- .../core/src/tools/contextHistory.spec.ts | 4 ++-- .../src/tools/createEventRateLimiter.spec.ts | 4 ++-- .../src/tools/getZoneJsOriginalValue.spec.ts | 2 +- .../core/src/tools/instrumentMethod.spec.ts | 5 ++--- packages/core/src/tools/urlPolyfill.spec.ts | 2 +- packages/core/src/tools/utils.spec.ts | 4 ++-- .../core/src/transport/eventBridge.spec.ts | 2 +- .../core/src/transport/httpRequest.spec.ts | 5 ++--- .../transport/sendWithRetryStrategy.spec.ts | 4 ++-- packages/core/test/index.ts | 6 ++++++ packages/logs/src/boot/logsPublicApi.spec.ts | 4 ++-- packages/logs/src/boot/startLogs.spec.ts | 13 ++++++------ packages/logs/src/domain/assembly.spec.ts | 5 ++--- .../logger/loggerCollection.spec.ts | 4 ++-- .../networkErrorCollection.spec.ts | 4 ++-- .../report/reportCollection.spec.ts | 2 +- .../src/domain/logsSessionManager.spec.ts | 4 ++-- .../rum-core/src/boot/rumPublicApi.spec.ts | 13 +++++++----- packages/rum-core/src/boot/startRum.spec.ts | 9 +++----- .../src/browser/domMutationObservable.spec.ts | 2 +- .../browser/locationChangeObservable.spec.ts | 2 +- .../src/browser/performanceCollection.spec.ts | 4 ++-- .../src/browser/viewportObservable.spec.ts | 4 ++-- packages/rum-core/src/domain/assembly.spec.ts | 21 ++++++++++++------- .../src/domain/contexts/ciTestContext.spec.ts | 5 +---- .../src/domain/contexts/commonContext.spec.ts | 2 +- .../contexts/featureFlagContext.spec.ts | 4 ++-- .../contexts/foregroundContexts.spec.ts | 6 +++--- .../domain/contexts/internalContext.spec.ts | 5 ++--- .../domain/contexts/pageStateHistory.spec.ts | 4 ++-- .../domain/contexts/syntheticsContext.spec.ts | 2 +- .../src/domain/contexts/urlContexts.spec.ts | 4 ++-- .../src/domain/contexts/viewContexts.spec.ts | 4 ++-- .../src/domain/requestCollection.spec.ts | 4 ++-- .../action/actionCollection.spec.ts | 6 +++--- .../action/clickChain.spec.ts | 6 +++--- .../action/computeFrustration.spec.ts | 10 ++++----- .../action/getActionNameFromElement.spec.ts | 4 ++-- .../action/getSelectorFromElement.spec.ts | 4 ++-- .../action/listenActionEvents.spec.ts | 2 +- .../action/trackClickActions.spec.ts | 7 +++---- .../error/errorCollection.spec.ts | 4 ++-- .../error/trackConsoleError.spec.ts | 4 ++-- .../error/trackReportError.spec.ts | 5 ++--- .../longTask/longTaskCollection.spec.ts | 6 ++---- .../resource/matchRequestTiming.spec.ts | 2 +- .../resource/resourceCollection.spec.ts | 6 ++---- .../resource/resourceUtils.spec.ts | 2 +- .../view/setupViewTest.specHelper.ts | 2 +- .../view/trackFirstHidden.spec.ts | 2 +- .../view/trackInitialViewTimings.spec.ts | 6 +++--- .../view/trackViewEventCounts.spec.ts | 4 ++-- .../view/trackViewMetrics.spec.ts | 4 ++-- .../view/trackViews.spec.ts | 4 ++-- .../view/viewCollection.spec.ts | 5 ++--- .../src/domain/rumSessionManager.spec.ts | 4 ++-- .../domain/startCustomerDataTelemetry.spec.ts | 4 ++-- .../src/domain/tracing/tracer.spec.ts | 6 ++---- .../src/domain/waitPageActivityEnd.spec.ts | 8 +++---- packages/rum-core/test/createFakeClick.ts | 2 +- packages/rum-core/test/index.ts | 8 +++++++ packages/rum-core/test/testSetupBuilder.ts | 4 ++-- packages/rum/src/boot/recorderApi.spec.ts | 8 +++---- packages/rum/src/boot/startRecording.spec.ts | 11 ++++------ .../src/domain/record/mutationBatch.spec.ts | 2 +- .../record/observers/inputObserver.spec.ts | 4 ++-- .../mouseInteractionObserver.spec.ts | 4 ++-- .../record/observers/moveObserver.spec.ts | 4 ++-- .../record/observers/mutationObserver.spec.ts | 4 ++-- .../observers/styleSheetObserver.spec.ts | 4 ++-- packages/rum/src/domain/record/record.spec.ts | 7 +++---- .../serialization/serializeNode.spec.ts | 6 +++--- .../serializeStyleSheets.spec.ts | 2 +- .../domain/segmentCollection/segment.spec.ts | 2 +- .../segmentCollection.spec.ts | 8 +++---- .../startDeflateWorker.spec.ts | 2 +- packages/rum/test/index.ts | 1 + .../scenario/recorder/recorder.scenario.ts | 2 +- .../scenario/recorder/shadowDom.scenario.ts | 8 +++---- .../scenario/recorder/viewports.scenario.ts | 2 +- 93 files changed, 208 insertions(+), 210 deletions(-) create mode 100644 packages/core/test/index.ts create mode 100644 packages/rum-core/test/index.ts create mode 100644 packages/rum/test/index.ts diff --git a/packages/core/src/browser/addEventListener.spec.ts b/packages/core/src/browser/addEventListener.spec.ts index ce4295ec56..1d94391955 100644 --- a/packages/core/src/browser/addEventListener.spec.ts +++ b/packages/core/src/browser/addEventListener.spec.ts @@ -1,4 +1,4 @@ -import { stubZoneJs } from '../../test/stubZoneJs' +import { stubZoneJs } from '../../test' import { noop } from '../tools/utils' import { addEventListener, DOM_EVENT } from './addEventListener' diff --git a/packages/core/src/browser/fetchObservable.spec.ts b/packages/core/src/browser/fetchObservable.spec.ts index 4c6f760ac2..18d61dafd0 100644 --- a/packages/core/src/browser/fetchObservable.spec.ts +++ b/packages/core/src/browser/fetchObservable.spec.ts @@ -1,5 +1,5 @@ -import type { FetchStub, FetchStubManager, FetchStubPromise } from '../../test/specHelper' -import { stubFetch } from '../../test/specHelper' +import type { FetchStub, FetchStubManager, FetchStubPromise } from '../../test' +import { stubFetch } from '../../test' import { isIE } from '../tools/browserDetection' import type { Subscription } from '../tools/observable' import type { FetchResolveContext, FetchContext } from './fetchObservable' diff --git a/packages/core/src/browser/pageExitObservable.spec.ts b/packages/core/src/browser/pageExitObservable.spec.ts index ec6274e686..aa534078b6 100644 --- a/packages/core/src/browser/pageExitObservable.spec.ts +++ b/packages/core/src/browser/pageExitObservable.spec.ts @@ -1,4 +1,4 @@ -import { createNewEvent, restorePageVisibility, setPageVisibility } from '../../test/specHelper' +import { createNewEvent, restorePageVisibility, setPageVisibility } from '../../test' import { resetExperimentalFeatures, updateExperimentalFeatures } from '../domain/configuration' import type { Subscription } from '../tools/observable' import type { PageExitEvent } from './pageExitObservable' diff --git a/packages/core/src/browser/timer.spec.ts b/packages/core/src/browser/timer.spec.ts index b66c84ddb2..c1f6ea8b94 100644 --- a/packages/core/src/browser/timer.spec.ts +++ b/packages/core/src/browser/timer.spec.ts @@ -1,6 +1,5 @@ -import { stubZoneJs } from '../../test/stubZoneJs' -import type { Clock } from '../../test/specHelper' -import { mockClock } from '../../test/specHelper' +import { mockClock, stubZoneJs } from '../../test' +import type { Clock } from '../../test' import { noop } from '../tools/utils' import { resetMonitor, startMonitorErrorCollection } from '../tools/monitor' import { setTimeout, clearTimeout, setInterval, clearInterval } from './timer' diff --git a/packages/core/src/browser/xhrObservable.spec.ts b/packages/core/src/browser/xhrObservable.spec.ts index fac252c625..1391c7d8d2 100644 --- a/packages/core/src/browser/xhrObservable.spec.ts +++ b/packages/core/src/browser/xhrObservable.spec.ts @@ -1,4 +1,4 @@ -import { stubXhr, withXhr } from '../../test/specHelper' +import { withXhr, stubXhr } from '../../test' import { isIE } from '../tools/browserDetection' import type { Subscription } from '../tools/observable' import type { XhrCompleteContext, XhrContext } from './xhrObservable' diff --git a/packages/core/src/domain/configuration/endpointBuilder.spec.ts b/packages/core/src/domain/configuration/endpointBuilder.spec.ts index f70cc6b78f..f5813cc319 100644 --- a/packages/core/src/domain/configuration/endpointBuilder.spec.ts +++ b/packages/core/src/domain/configuration/endpointBuilder.spec.ts @@ -1,4 +1,4 @@ -import type { BuildEnvWindow } from '../../../test/specHelper' +import type { BuildEnvWindow } from '../../../test' import { startsWith } from '../../tools/utils' import type { InitConfiguration } from './configuration' import { createEndpointBuilder } from './endpointBuilder' diff --git a/packages/core/src/domain/report/reportObservable.spec.ts b/packages/core/src/domain/report/reportObservable.spec.ts index 9866b09f6a..a6142382d5 100644 --- a/packages/core/src/domain/report/reportObservable.spec.ts +++ b/packages/core/src/domain/report/reportObservable.spec.ts @@ -1,5 +1,5 @@ +import { stubReportingObserver, stubCspEventListener } from '../../../test' import type { Subscription } from '../../tools/observable' -import { stubReportingObserver, stubCspEventListener } from '../../../test/stubReportApis' import { initReportObservable, RawReportType } from './reportObservable' describe('report observable', () => { diff --git a/packages/core/src/domain/session/sessionCookieStore.spec.ts b/packages/core/src/domain/session/sessionCookieStore.spec.ts index 8ec1a65b23..74d06b1deb 100644 --- a/packages/core/src/domain/session/sessionCookieStore.spec.ts +++ b/packages/core/src/domain/session/sessionCookieStore.spec.ts @@ -1,4 +1,4 @@ -import { stubCookie, mockClock } from '../../../test/specHelper' +import { mockClock, stubCookie } from '../../../test' import { isChromium } from '../../tools/browserDetection' import { SESSION_COOKIE_NAME, diff --git a/packages/core/src/domain/session/sessionManager.spec.ts b/packages/core/src/domain/session/sessionManager.spec.ts index 77b94e45b9..50f62249ba 100644 --- a/packages/core/src/domain/session/sessionManager.spec.ts +++ b/packages/core/src/domain/session/sessionManager.spec.ts @@ -1,7 +1,7 @@ +import { createNewEvent, mockClock, restorePageVisibility, setPageVisibility } from '../../../test' +import type { Clock } from '../../../test' import type { CookieOptions } from '../../browser/cookie' import { COOKIE_ACCESS_DELAY, getCookie, setCookie } from '../../browser/cookie' -import type { Clock } from '../../../test/specHelper' -import { mockClock, restorePageVisibility, setPageVisibility, createNewEvent } from '../../../test/specHelper' import { ONE_HOUR, ONE_SECOND } from '../../tools/utils' import type { RelativeTime } from '../../tools/timeUtils' import { isIE } from '../../tools/browserDetection' diff --git a/packages/core/src/domain/session/sessionStore.spec.ts b/packages/core/src/domain/session/sessionStore.spec.ts index b4c8b4e068..a4123e9b06 100644 --- a/packages/core/src/domain/session/sessionStore.spec.ts +++ b/packages/core/src/domain/session/sessionStore.spec.ts @@ -1,5 +1,5 @@ -import type { Clock } from '../../../test/specHelper' -import { mockClock } from '../../../test/specHelper' +import type { Clock } from '../../../test' +import { mockClock } from '../../../test' import type { CookieOptions } from '../../browser/cookie' import { getCookie, setCookie, COOKIE_ACCESS_DELAY } from '../../browser/cookie' import type { SessionStore } from './sessionStore' diff --git a/packages/core/src/domain/synthetics/syntheticsWorkerValues.spec.ts b/packages/core/src/domain/synthetics/syntheticsWorkerValues.spec.ts index 6689fcb71b..30a4d70abc 100644 --- a/packages/core/src/domain/synthetics/syntheticsWorkerValues.spec.ts +++ b/packages/core/src/domain/synthetics/syntheticsWorkerValues.spec.ts @@ -1,4 +1,4 @@ -import { mockSyntheticsWorkerValues, cleanupSyntheticsWorkerValues } from '../../../test/syntheticsWorkerValues' +import { mockSyntheticsWorkerValues, cleanupSyntheticsWorkerValues } from '../../../test' import { getSyntheticsResultId, getSyntheticsTestId, willSyntheticsInjectRum } from './syntheticsWorkerValues' describe('syntheticsWorkerValues', () => { diff --git a/packages/core/src/domain/tracekit/computeStackTrace.spec.ts b/packages/core/src/domain/tracekit/computeStackTrace.spec.ts index 84920d220a..2426ddeb2e 100644 --- a/packages/core/src/domain/tracekit/computeStackTrace.spec.ts +++ b/packages/core/src/domain/tracekit/computeStackTrace.spec.ts @@ -1,5 +1,5 @@ -import { isSafari } from '../../../test/specHelper' -import * as CapturedExceptions from '../../../test/capturedExceptions' +import * as CapturedExceptions from '../../../test' +import { isSafari } from '../../../test' import { computeStackTrace } from './computeStackTrace' describe('computeStackTrace', () => { diff --git a/packages/core/src/domain/tracekit/tracekit.spec.ts b/packages/core/src/domain/tracekit/tracekit.spec.ts index 1afb9d6c66..f0a3780c83 100644 --- a/packages/core/src/domain/tracekit/tracekit.spec.ts +++ b/packages/core/src/domain/tracekit/tracekit.spec.ts @@ -1,4 +1,4 @@ -import { disableJasmineUncaughtErrorHandler } from '../../../test/specHelper' +import { disableJasmineUncaughtErrorHandler } from '../../../test' import { startUnhandledErrorCollection } from './tracekit' import type { UnhandledErrorCallback } from './types' diff --git a/packages/core/src/tools/contextHistory.spec.ts b/packages/core/src/tools/contextHistory.spec.ts index 46d8e18a7c..957979213b 100644 --- a/packages/core/src/tools/contextHistory.spec.ts +++ b/packages/core/src/tools/contextHistory.spec.ts @@ -1,5 +1,5 @@ -import type { Clock } from '../../test/specHelper' -import { mockClock } from '../../test/specHelper' +import type { Clock } from '../../test' +import { mockClock } from '../../test' import type { Duration, RelativeTime } from './timeUtils' import { addDuration } from './timeUtils' import { ONE_MINUTE } from './utils' diff --git a/packages/core/src/tools/createEventRateLimiter.spec.ts b/packages/core/src/tools/createEventRateLimiter.spec.ts index 9c73d0171a..1620f86683 100644 --- a/packages/core/src/tools/createEventRateLimiter.spec.ts +++ b/packages/core/src/tools/createEventRateLimiter.spec.ts @@ -1,5 +1,5 @@ -import type { Clock } from '../../test/specHelper' -import { mockClock } from '../../test/specHelper' +import type { Clock } from '../../test' +import { mockClock } from '../../test' import type { RawError } from './error' import type { EventRateLimiter } from './createEventRateLimiter' import { createEventRateLimiter } from './createEventRateLimiter' diff --git a/packages/core/src/tools/getZoneJsOriginalValue.spec.ts b/packages/core/src/tools/getZoneJsOriginalValue.spec.ts index 88850387bc..dbfb5ecb8a 100644 --- a/packages/core/src/tools/getZoneJsOriginalValue.spec.ts +++ b/packages/core/src/tools/getZoneJsOriginalValue.spec.ts @@ -1,4 +1,4 @@ -import { stubZoneJs } from '../../test/stubZoneJs' +import { stubZoneJs } from '../../test' import type { BrowserWindowWithZoneJs } from './getZoneJsOriginalValue' import { getZoneJsOriginalValue } from './getZoneJsOriginalValue' diff --git a/packages/core/src/tools/instrumentMethod.spec.ts b/packages/core/src/tools/instrumentMethod.spec.ts index 47c02445f5..9130428521 100644 --- a/packages/core/src/tools/instrumentMethod.spec.ts +++ b/packages/core/src/tools/instrumentMethod.spec.ts @@ -1,6 +1,5 @@ -import { stubZoneJs } from '../../test/stubZoneJs' -import type { Clock } from '../../test/specHelper' -import { mockClock } from '../../test/specHelper' +import { mockClock, stubZoneJs } from '../../test' +import type { Clock } from '../../test' import { instrumentMethod, instrumentSetter } from './instrumentMethod' import { noop } from './utils' diff --git a/packages/core/src/tools/urlPolyfill.spec.ts b/packages/core/src/tools/urlPolyfill.spec.ts index 7ec669abba..8aca707c52 100644 --- a/packages/core/src/tools/urlPolyfill.spec.ts +++ b/packages/core/src/tools/urlPolyfill.spec.ts @@ -1,4 +1,4 @@ -import { isFirefox } from '../../test/specHelper' +import { isFirefox } from '../../test' import { getHash, getOrigin, getPathName, getSearch, isValidUrl, normalizeUrl } from './urlPolyfill' import { getLocationOrigin } from './utils' diff --git a/packages/core/src/tools/utils.spec.ts b/packages/core/src/tools/utils.spec.ts index 92d40dc874..5264ed648c 100644 --- a/packages/core/src/tools/utils.spec.ts +++ b/packages/core/src/tools/utils.spec.ts @@ -1,5 +1,5 @@ -import type { Clock } from '../../test/specHelper' -import { mockClock } from '../../test/specHelper' +import type { Clock } from '../../test' +import { mockClock } from '../../test' import { display } from './display' import { arrayFrom, diff --git a/packages/core/src/transport/eventBridge.spec.ts b/packages/core/src/transport/eventBridge.spec.ts index 13e6260a3f..a9d3e2bfdb 100644 --- a/packages/core/src/transport/eventBridge.spec.ts +++ b/packages/core/src/transport/eventBridge.spec.ts @@ -1,4 +1,4 @@ -import { deleteEventBridgeStub, initEventBridgeStub } from '../../test/specHelper' +import { deleteEventBridgeStub, initEventBridgeStub } from '../../test' import { getEventBridge, canUseEventBridge } from './eventBridge' describe('canUseEventBridge', () => { diff --git a/packages/core/src/transport/httpRequest.spec.ts b/packages/core/src/transport/httpRequest.spec.ts index f3551e538f..354608ad46 100644 --- a/packages/core/src/transport/httpRequest.spec.ts +++ b/packages/core/src/transport/httpRequest.spec.ts @@ -1,9 +1,8 @@ -import { stubEndpointBuilder, interceptRequests } from '../../test/specHelper' -import type { Request } from '../../test/specHelper' +import { collectAsyncCalls, stubEndpointBuilder, interceptRequests } from '../../test' +import type { Request } from '../../test' import type { EndpointBuilder } from '../domain/configuration' import { createEndpointBuilder } from '../domain/configuration' import { noop } from '../tools/utils' -import { collectAsyncCalls } from '../../test/collectAsyncCalls' import { createHttpRequest, fetchKeepAliveStrategy, sendXHR } from './httpRequest' import type { HttpRequest } from './httpRequest' diff --git a/packages/core/src/transport/sendWithRetryStrategy.spec.ts b/packages/core/src/transport/sendWithRetryStrategy.spec.ts index 80978d4f0a..a4e62641e7 100644 --- a/packages/core/src/transport/sendWithRetryStrategy.spec.ts +++ b/packages/core/src/transport/sendWithRetryStrategy.spec.ts @@ -1,5 +1,5 @@ -import { mockClock, restoreNavigatorOnLine, setNavigatorOnLine } from '../../test/specHelper' -import type { Clock } from '../../test/specHelper' +import { mockClock, restoreNavigatorOnLine, setNavigatorOnLine } from '../../test' +import type { Clock } from '../../test' import { ErrorSource } from '../tools/error' import type { RetryState } from './sendWithRetryStrategy' import { diff --git a/packages/core/test/index.ts b/packages/core/test/index.ts new file mode 100644 index 0000000000..38a780b548 --- /dev/null +++ b/packages/core/test/index.ts @@ -0,0 +1,6 @@ +export * from './capturedExceptions' +export * from './collectAsyncCalls' +export * from './stubReportApis' +export * from './stubZoneJs' +export * from './syntheticsWorkerValues' +export * from './specHelper' diff --git a/packages/logs/src/boot/logsPublicApi.spec.ts b/packages/logs/src/boot/logsPublicApi.spec.ts index 86b29ee22f..b383e68f98 100644 --- a/packages/logs/src/boot/logsPublicApi.spec.ts +++ b/packages/logs/src/boot/logsPublicApi.spec.ts @@ -1,7 +1,7 @@ import type { TimeStamp } from '@datadog/browser-core' import { monitor, ONE_SECOND, display } from '@datadog/browser-core' -import type { Clock } from '../../../core/test/specHelper' -import { deleteEventBridgeStub, initEventBridgeStub, mockClock } from '../../../core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { deleteEventBridgeStub, initEventBridgeStub, mockClock } from '@datadog/browser-core/test' import type { HybridInitConfiguration, LogsInitConfiguration } from '../domain/configuration' import type { Logger, LogsMessage } from '../domain/logger' import { HandlerType, StatusType } from '../domain/logger' diff --git a/packages/logs/src/boot/startLogs.spec.ts b/packages/logs/src/boot/startLogs.spec.ts index ba93f2d582..3c0b482007 100644 --- a/packages/logs/src/boot/startLogs.spec.ts +++ b/packages/logs/src/boot/startLogs.spec.ts @@ -1,15 +1,16 @@ import { ErrorSource, display, stopSessionManager, getCookie, SESSION_COOKIE_NAME } from '@datadog/browser-core' -import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../core/test/syntheticsWorkerValues' +import type { Request } from '@datadog/browser-core/test' import { + interceptRequests, + stubEndpointBuilder, deleteEventBridgeStub, initEventBridgeStub, - stubEndpointBuilder, - interceptRequests, -} from '../../../core/test/specHelper' -import type { Request } from '../../../core/test/specHelper' + cleanupSyntheticsWorkerValues, + mockSyntheticsWorkerValues, +} from '@datadog/browser-core/test' + import type { LogsConfiguration } from '../domain/configuration' import { validateAndBuildLogsConfiguration } from '../domain/configuration' - import { HandlerType, Logger, StatusType } from '../domain/logger' import type { startLoggerCollection } from '../domain/logsCollection/logger/loggerCollection' import type { LogsEvent } from '../logsEvent.types' diff --git a/packages/logs/src/domain/assembly.spec.ts b/packages/logs/src/domain/assembly.spec.ts index dc11fd543e..89784aa38b 100644 --- a/packages/logs/src/domain/assembly.spec.ts +++ b/packages/logs/src/domain/assembly.spec.ts @@ -1,9 +1,8 @@ import type { Context, RelativeTime, TelemetryEvent, TimeStamp } from '@datadog/browser-core' import { TelemetryService, startTelemetry, ErrorSource, ONE_MINUTE, getTimeStamp, noop } from '@datadog/browser-core' -import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../core/test/syntheticsWorkerValues' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock, cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '@datadog/browser-core/test' import type { LogsEvent } from '../logsEvent.types' -import type { Clock } from '../../../core/test/specHelper' -import { mockClock } from '../../../core/test/specHelper' import type { CommonContext } from '../rawLogsEvent.types' import { getRUMInternalContext, resetRUMInternalContext, startLogsAssembly } from './assembly' import { validateAndBuildLogsConfiguration } from './configuration' diff --git a/packages/logs/src/domain/logsCollection/logger/loggerCollection.spec.ts b/packages/logs/src/domain/logsCollection/logger/loggerCollection.spec.ts index 6023ceeb0a..b59d1f37c0 100644 --- a/packages/logs/src/domain/logsCollection/logger/loggerCollection.spec.ts +++ b/packages/logs/src/domain/logsCollection/logger/loggerCollection.spec.ts @@ -1,7 +1,7 @@ import type { TimeStamp } from '@datadog/browser-core' import { ConsoleApiName, timeStampNow, display, ErrorSource } from '@datadog/browser-core' -import type { Clock } from '@datadog/browser-core/test/specHelper' -import { mockClock } from '@datadog/browser-core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import type { CommonContext, RawLoggerLogsEvent } from '../../../rawLogsEvent.types' import type { RawLogsEventCollectedData } from '../../lifeCycle' import { LifeCycle, LifeCycleEventType } from '../../lifeCycle' diff --git a/packages/logs/src/domain/logsCollection/networkError/networkErrorCollection.spec.ts b/packages/logs/src/domain/logsCollection/networkError/networkErrorCollection.spec.ts index 3701746b11..44cfa550d5 100644 --- a/packages/logs/src/domain/logsCollection/networkError/networkErrorCollection.spec.ts +++ b/packages/logs/src/domain/logsCollection/networkError/networkErrorCollection.spec.ts @@ -1,6 +1,6 @@ import { isIE, ErrorSource } from '@datadog/browser-core' -import type { FetchStub, FetchStubManager } from '@datadog/browser-core/test/specHelper' -import { SPEC_ENDPOINTS, ResponseStub, stubFetch } from '@datadog/browser-core/test/specHelper' +import type { FetchStub, FetchStubManager } from '@datadog/browser-core/test' +import { SPEC_ENDPOINTS, ResponseStub, stubFetch } from '@datadog/browser-core/test' import type { RawNetworkLogsEvent } from '../../../rawLogsEvent.types' import type { LogsConfiguration } from '../../configuration' import type { RawLogsEventCollectedData } from '../../lifeCycle' diff --git a/packages/logs/src/domain/logsCollection/report/reportCollection.spec.ts b/packages/logs/src/domain/logsCollection/report/reportCollection.spec.ts index 97463d2e50..5b5a4e0610 100644 --- a/packages/logs/src/domain/logsCollection/report/reportCollection.spec.ts +++ b/packages/logs/src/domain/logsCollection/report/reportCollection.spec.ts @@ -1,5 +1,5 @@ import { ErrorSource, noop } from '@datadog/browser-core' -import { stubReportingObserver } from '@datadog/browser-core/test/stubReportApis' +import { stubReportingObserver } from '@datadog/browser-core/test' import type { RawReportLogsEvent } from '../../../rawLogsEvent.types' import { validateAndBuildLogsConfiguration } from '../../configuration' import type { RawLogsEventCollectedData } from '../../lifeCycle' diff --git a/packages/logs/src/domain/logsSessionManager.spec.ts b/packages/logs/src/domain/logsSessionManager.spec.ts index 4d3f32f712..14d51be950 100644 --- a/packages/logs/src/domain/logsSessionManager.spec.ts +++ b/packages/logs/src/domain/logsSessionManager.spec.ts @@ -7,8 +7,8 @@ import { stopSessionManager, ONE_SECOND, } from '@datadog/browser-core' -import type { Clock } from '../../../core/test/specHelper' -import { mockClock } from '../../../core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import type { LogsConfiguration } from './configuration' import { diff --git a/packages/rum-core/src/boot/rumPublicApi.spec.ts b/packages/rum-core/src/boot/rumPublicApi.spec.ts index 64a62d3bf3..455f13fdd6 100644 --- a/packages/rum-core/src/boot/rumPublicApi.spec.ts +++ b/packages/rum-core/src/boot/rumPublicApi.spec.ts @@ -1,12 +1,15 @@ import type { RelativeTime, TimeStamp, Context } from '@datadog/browser-core' import { ONE_SECOND, getTimeStamp, display, DefaultPrivacyLevel } from '@datadog/browser-core' -import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../core/test/syntheticsWorkerValues' -import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper' -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import { + initEventBridgeStub, + deleteEventBridgeStub, + cleanupSyntheticsWorkerValues, + mockSyntheticsWorkerValues, +} from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../test' +import { setup, noopRecorderApi } from '../../test' import type { HybridInitConfiguration, RumInitConfiguration } from '../domain/configuration' import { ActionType } from '../rawRumEvent.types' -import { noopRecorderApi } from '../../test/noopRecorderApi' import type { RumPublicApi, StartRum, RecorderApi } from './rumPublicApi' import { makeRumPublicApi } from './rumPublicApi' diff --git a/packages/rum-core/src/boot/startRum.spec.ts b/packages/rum-core/src/boot/startRum.spec.ts index 829146c6c3..dd5dd2fdba 100644 --- a/packages/rum-core/src/boot/startRum.spec.ts +++ b/packages/rum-core/src/boot/startRum.spec.ts @@ -9,11 +9,9 @@ import { relativeNow, isIE, } from '@datadog/browser-core' -import { createNewEvent, interceptRequests } from '../../../core/test/specHelper' -import type { RumSessionManagerMock } from '../../test/mockRumSessionManager' -import { createRumSessionManagerMock } from '../../test/mockRumSessionManager' -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import { createNewEvent, interceptRequests } from '@datadog/browser-core/test' +import type { RumSessionManagerMock, TestSetupBuilder } from '../../test' +import { createRumSessionManagerMock, noopRecorderApi, setup } from '../../test' import type { RumPerformanceNavigationTiming, RumPerformanceEntry } from '../browser/performanceCollection' import type { LifeCycle } from '../domain/lifeCycle' import { LifeCycleEventType } from '../domain/lifeCycle' @@ -26,7 +24,6 @@ import type { RumSessionManager } from '..' import type { RumConfiguration, RumInitConfiguration } from '../domain/configuration' import { RumEventType } from '../rawRumEvent.types' import { startFeatureFlagContexts } from '../domain/contexts/featureFlagContext' -import { noopRecorderApi } from '../../test/noopRecorderApi' import { startRum, startRumEventCollection } from './startRum' function collectServerEvents(lifeCycle: LifeCycle) { diff --git a/packages/rum-core/src/browser/domMutationObservable.spec.ts b/packages/rum-core/src/browser/domMutationObservable.spec.ts index a78973dd28..759c700836 100644 --- a/packages/rum-core/src/browser/domMutationObservable.spec.ts +++ b/packages/rum-core/src/browser/domMutationObservable.spec.ts @@ -1,5 +1,5 @@ import { isIE } from '@datadog/browser-core' -import { stubZoneJs } from '../../../core/test/stubZoneJs' +import { stubZoneJs } from '@datadog/browser-core/test' import { createDOMMutationObservable, getMutationObserverConstructor } from './domMutationObservable' // The MutationObserver invokes its callback in an event loop microtask, making this asynchronous. diff --git a/packages/rum-core/src/browser/locationChangeObservable.spec.ts b/packages/rum-core/src/browser/locationChangeObservable.spec.ts index ad03cdb6e2..3c3dbf6788 100644 --- a/packages/rum-core/src/browser/locationChangeObservable.spec.ts +++ b/packages/rum-core/src/browser/locationChangeObservable.spec.ts @@ -1,5 +1,5 @@ import type { Observable, Subscription } from '@datadog/browser-core' -import { mockLocation } from '../../../core/test/specHelper' +import { mockLocation } from '@datadog/browser-core/test' import type { LocationChange } from './locationChangeObservable' import { createLocationChangeObservable } from './locationChangeObservable' diff --git a/packages/rum-core/src/browser/performanceCollection.spec.ts b/packages/rum-core/src/browser/performanceCollection.spec.ts index 2b9360b330..af56a4029f 100644 --- a/packages/rum-core/src/browser/performanceCollection.spec.ts +++ b/packages/rum-core/src/browser/performanceCollection.spec.ts @@ -1,5 +1,5 @@ -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../test' +import { setup } from '../../test' import { retrieveInitialDocumentResourceTiming, startPerformanceCollection } from './performanceCollection' describe('rum initial document resource', () => { diff --git a/packages/rum-core/src/browser/viewportObservable.spec.ts b/packages/rum-core/src/browser/viewportObservable.spec.ts index 02df2617f1..2ea15be26e 100644 --- a/packages/rum-core/src/browser/viewportObservable.spec.ts +++ b/packages/rum-core/src/browser/viewportObservable.spec.ts @@ -1,6 +1,6 @@ -import type { Clock } from '@datadog/browser-core/test/specHelper' -import { createNewEvent, mockClock } from '@datadog/browser-core/test/specHelper' import type { Subscription } from '@datadog/browser-core/src/tools/observable' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock, createNewEvent } from '@datadog/browser-core/test' import type { ViewportDimension } from './viewportObservable' import { getViewportDimension, initViewportObservable } from './viewportObservable' diff --git a/packages/rum-core/src/domain/assembly.spec.ts b/packages/rum-core/src/domain/assembly.spec.ts index dab6a5cf7a..db57c06a24 100644 --- a/packages/rum-core/src/domain/assembly.spec.ts +++ b/packages/rum-core/src/domain/assembly.spec.ts @@ -1,16 +1,23 @@ import type { RelativeTime } from '@datadog/browser-core' import { ErrorSource, ONE_MINUTE, display } from '@datadog/browser-core' -import { createRumSessionManagerMock } from '../../test/mockRumSessionManager' -import { createRawRumEvent } from '../../test/fixtures' -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import { + initEventBridgeStub, + deleteEventBridgeStub, + cleanupSyntheticsWorkerValues, + mockSyntheticsWorkerValues, +} from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../test' +import { + createRumSessionManagerMock, + mockCiVisibilityWindowValues, + setup, + createRawRumEvent, + cleanupCiVisibilityWindowValues, +} from '../../test' import type { RumEventDomainContext } from '../domainContext.types' import type { RawRumActionEvent, RawRumErrorEvent, RawRumEvent } from '../rawRumEvent.types' import { RumEventType } from '../rawRumEvent.types' import type { RumActionEvent, RumErrorEvent, RumEvent } from '../rumEvent.types' -import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper' -import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../core/test/syntheticsWorkerValues' -import { cleanupCiVisibilityWindowValues, mockCiVisibilityWindowValues } from '../../test/mockCiVisibilityWindowValues' import { startRumAssembly } from './assembly' import type { LifeCycle, RawRumEventCollectedData } from './lifeCycle' import { LifeCycleEventType } from './lifeCycle' diff --git a/packages/rum-core/src/domain/contexts/ciTestContext.spec.ts b/packages/rum-core/src/domain/contexts/ciTestContext.spec.ts index 4fac9fa668..8ee552533f 100644 --- a/packages/rum-core/src/domain/contexts/ciTestContext.spec.ts +++ b/packages/rum-core/src/domain/contexts/ciTestContext.spec.ts @@ -1,7 +1,4 @@ -import { - cleanupCiVisibilityWindowValues, - mockCiVisibilityWindowValues, -} from '../../../test/mockCiVisibilityWindowValues' +import { cleanupCiVisibilityWindowValues, mockCiVisibilityWindowValues } from '../../../test' import { getCiTestContext } from './ciTestContext' describe('getCiTestContext', () => { diff --git a/packages/rum-core/src/domain/contexts/commonContext.spec.ts b/packages/rum-core/src/domain/contexts/commonContext.spec.ts index 1552bb27f2..210394ba7c 100644 --- a/packages/rum-core/src/domain/contexts/commonContext.spec.ts +++ b/packages/rum-core/src/domain/contexts/commonContext.spec.ts @@ -1,7 +1,7 @@ import type { Context, ContextManager } from '@datadog/browser-core' import { createContextManager } from '@datadog/browser-core' import type { RecorderApi } from '../../boot/rumPublicApi' -import { noopRecorderApi } from '../../../test/noopRecorderApi' +import { noopRecorderApi } from '../../../test' import type { CommonContext } from './commonContext' import { buildCommonContext as buildCommonContextImpl } from './commonContext' diff --git a/packages/rum-core/src/domain/contexts/featureFlagContext.spec.ts b/packages/rum-core/src/domain/contexts/featureFlagContext.spec.ts index 1f20b5816e..3f31e087d2 100644 --- a/packages/rum-core/src/domain/contexts/featureFlagContext.spec.ts +++ b/packages/rum-core/src/domain/contexts/featureFlagContext.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime } from '@datadog/browser-core' import { resetExperimentalFeatures, updateExperimentalFeatures, relativeToClocks } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../test' +import { setup } from '../../../test' import { LifeCycleEventType } from '../lifeCycle' import type { ViewCreatedEvent, ViewEndedEvent } from '../rumEventsCollection/view/trackViews' import type { FeatureFlagContexts } from './featureFlagContext' diff --git a/packages/rum-core/src/domain/contexts/foregroundContexts.spec.ts b/packages/rum-core/src/domain/contexts/foregroundContexts.spec.ts index 1f1bdae68e..1ee0b4be03 100644 --- a/packages/rum-core/src/domain/contexts/foregroundContexts.spec.ts +++ b/packages/rum-core/src/domain/contexts/foregroundContexts.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime, Duration, ServerDuration } from '@datadog/browser-core' import { relativeNow } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../test' +import { setup } from '../../../test' import type { ForegroundContexts } from './foregroundContexts' import { startForegroundContexts, @@ -58,7 +58,7 @@ describe('foreground context', () => { }) describe('with two closed focus period & one active one', () => { - /* + /* events F B F B F periods <------> <-------> <---- - - - time 0 5 10 15 20 25 30 35 40 45 diff --git a/packages/rum-core/src/domain/contexts/internalContext.spec.ts b/packages/rum-core/src/domain/contexts/internalContext.spec.ts index 578939bc64..209b253216 100644 --- a/packages/rum-core/src/domain/contexts/internalContext.spec.ts +++ b/packages/rum-core/src/domain/contexts/internalContext.spec.ts @@ -1,7 +1,6 @@ import type { RelativeTime } from '@datadog/browser-core' -import { createRumSessionManagerMock } from '../../../test/mockRumSessionManager' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import { createRumSessionManagerMock, setup } from '../../../test' +import type { TestSetupBuilder } from '../../../test' import type { ActionContexts } from '../rumEventsCollection/action/actionCollection' import type { RumSessionManager } from '../rumSessionManager' import { startInternalContext } from './internalContext' diff --git a/packages/rum-core/src/domain/contexts/pageStateHistory.spec.ts b/packages/rum-core/src/domain/contexts/pageStateHistory.spec.ts index 2b67a55286..6a6cef4258 100644 --- a/packages/rum-core/src/domain/contexts/pageStateHistory.spec.ts +++ b/packages/rum-core/src/domain/contexts/pageStateHistory.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime } from '@datadog/browser-core' import { resetExperimentalFeatures } from '@datadog/browser-core' -import type { TestSetupBuilder } from 'packages/rum-core/test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../test' +import { setup } from '../../../test' import type { PageStateHistory } from './pageStateHistory' import { resetPageStates, startPageStateHistory, addPageState, PageState } from './pageStateHistory' diff --git a/packages/rum-core/src/domain/contexts/syntheticsContext.spec.ts b/packages/rum-core/src/domain/contexts/syntheticsContext.spec.ts index ccab69ecb8..d22065d5db 100644 --- a/packages/rum-core/src/domain/contexts/syntheticsContext.spec.ts +++ b/packages/rum-core/src/domain/contexts/syntheticsContext.spec.ts @@ -1,4 +1,4 @@ -import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../../core/test/syntheticsWorkerValues' +import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../../core/test' import { getSyntheticsContext } from './syntheticsContext' describe('getSyntheticsContext', () => { diff --git a/packages/rum-core/src/domain/contexts/urlContexts.spec.ts b/packages/rum-core/src/domain/contexts/urlContexts.spec.ts index ade00e7feb..33dc4de96d 100644 --- a/packages/rum-core/src/domain/contexts/urlContexts.spec.ts +++ b/packages/rum-core/src/domain/contexts/urlContexts.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime } from '@datadog/browser-core' import { relativeToClocks } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../test' +import { setup } from '../../../test' import { LifeCycleEventType } from '../lifeCycle' import type { ViewCreatedEvent, ViewEndedEvent } from '../rumEventsCollection/view/trackViews' import type { UrlContexts } from './urlContexts' diff --git a/packages/rum-core/src/domain/contexts/viewContexts.spec.ts b/packages/rum-core/src/domain/contexts/viewContexts.spec.ts index da44b77ac7..11a5279036 100644 --- a/packages/rum-core/src/domain/contexts/viewContexts.spec.ts +++ b/packages/rum-core/src/domain/contexts/viewContexts.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime } from '@datadog/browser-core' import { relativeToClocks, CLEAR_OLD_CONTEXTS_INTERVAL } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../test' +import { setup } from '../../../test' import { LifeCycleEventType } from '../lifeCycle' import type { ViewCreatedEvent } from '../rumEventsCollection/view/trackViews' import type { ViewContexts } from './viewContexts' diff --git a/packages/rum-core/src/domain/requestCollection.spec.ts b/packages/rum-core/src/domain/requestCollection.spec.ts index b8baf3b292..d3713f406c 100644 --- a/packages/rum-core/src/domain/requestCollection.spec.ts +++ b/packages/rum-core/src/domain/requestCollection.spec.ts @@ -1,6 +1,6 @@ import { isIE, RequestType } from '@datadog/browser-core' -import type { FetchStub, FetchStubManager } from '../../../core/test/specHelper' -import { SPEC_ENDPOINTS, stubFetch, stubXhr, withXhr } from '../../../core/test/specHelper' +import type { FetchStub, FetchStubManager } from '@datadog/browser-core/test' +import { SPEC_ENDPOINTS, stubFetch, stubXhr, withXhr } from '@datadog/browser-core/test' import type { RumConfiguration } from './configuration' import { validateAndBuildRumConfiguration } from './configuration' import { LifeCycle, LifeCycleEventType } from './lifeCycle' diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/actionCollection.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/actionCollection.spec.ts index 03b6e0113a..a6b2ca4c77 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/actionCollection.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/actionCollection.spec.ts @@ -1,7 +1,7 @@ import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core' -import { createNewEvent } from '../../../../../core/test/specHelper' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import { createNewEvent } from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../../../test' +import { setup } from '../../../../test' import { RumEventType, ActionType } from '../../../rawRumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' import { startActionCollection } from './actionCollection' diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/clickChain.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/clickChain.spec.ts index 6fac9da09b..ea933adee0 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/clickChain.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/clickChain.spec.ts @@ -1,6 +1,6 @@ -import type { Clock } from '@datadog/browser-core/test/specHelper' -import { mockClock } from '@datadog/browser-core/test/specHelper' -import { createFakeClick } from '../../../../test/createFakeClick' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' +import { createFakeClick } from '../../../../test' import type { ClickChain } from './clickChain' import { MAX_DISTANCE_BETWEEN_CLICKS, MAX_DURATION_BETWEEN_CLICKS, createClickChain } from './clickChain' diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts index a44a52f151..b19c1f52cb 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/computeFrustration.spec.ts @@ -1,11 +1,9 @@ import { ONE_SECOND } from '@datadog/browser-core' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import { FrustrationType } from '../../../rawRumEvent.types' -import type { Clock } from '../../../../../core/test/specHelper' -import { mockClock } from '../../../../../core/test/specHelper' -import type { FakeClick } from '../../../../test/createFakeClick' -import { createFakeClick } from '../../../../test/createFakeClick' -import type { IsolatedDom } from '../../../../test/createIsolatedDom' -import { createIsolatedDom } from '../../../../test/createIsolatedDom' +import type { FakeClick, IsolatedDom } from '../../../../test' +import { createFakeClick, createIsolatedDom } from '../../../../test' import { computeFrustration, isRage, isDead } from './computeFrustration' describe('computeFrustration', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/getActionNameFromElement.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/getActionNameFromElement.spec.ts index d8b6a6259c..443683295e 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/getActionNameFromElement.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/getActionNameFromElement.spec.ts @@ -1,5 +1,5 @@ -import type { IsolatedDom } from '../../../../test/createIsolatedDom' -import { createIsolatedDom } from '../../../../test/createIsolatedDom' +import type { IsolatedDom } from '../../../../test' +import { createIsolatedDom } from '../../../../test' import { getActionNameFromElement } from './getActionNameFromElement' describe('getActionNameFromElement', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/getSelectorFromElement.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/getSelectorFromElement.spec.ts index c087b04120..f4af021cdd 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/getSelectorFromElement.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/getSelectorFromElement.spec.ts @@ -1,5 +1,5 @@ -import type { IsolatedDom } from '../../../../test/createIsolatedDom' -import { createIsolatedDom } from '../../../../test/createIsolatedDom' +import type { IsolatedDom } from '../../../../test' +import { createIsolatedDom } from '../../../../test' import { getSelectorFromElement, supportScopeSelector } from './getSelectorFromElement' describe('getSelectorFromElement', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/listenActionEvents.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/listenActionEvents.spec.ts index 5e2a53288b..232412ab42 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/listenActionEvents.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/listenActionEvents.spec.ts @@ -1,4 +1,4 @@ -import { createNewEvent } from '../../../../../core/test/specHelper' +import { createNewEvent } from '@datadog/browser-core/test' import type { ActionEventsHooks } from './listenActionEvents' import { listenActionEvents } from './listenActionEvents' diff --git a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts index a4b95742d2..30283d20df 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/action/trackClickActions.spec.ts @@ -7,14 +7,13 @@ import { timeStampNow, relativeNow, } from '@datadog/browser-core' -import { createNewEvent } from '../../../../../core/test/specHelper' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import { createNewEvent } from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../../../test' +import { setup, createFakeClick } from '../../../../test' import { RumEventType, ActionType, FrustrationType } from '../../../rawRumEvent.types' import type { RumEvent } from '../../../rumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' import { PAGE_ACTIVITY_VALIDATION_DELAY } from '../../waitPageActivityEnd' -import { createFakeClick } from '../../../../test/createFakeClick' import type { ActionContexts } from './actionCollection' import type { ClickAction } from './trackClickActions' import { finalizeClicks, CLICK_ACTION_MAX_DURATION, trackClickActions } from './trackClickActions' diff --git a/packages/rum-core/src/domain/rumEventsCollection/error/errorCollection.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/error/errorCollection.spec.ts index e1c83c2890..3b3770a2fd 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/error/errorCollection.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/error/errorCollection.spec.ts @@ -1,7 +1,7 @@ import type { RelativeTime, TimeStamp, ErrorWithCause } from '@datadog/browser-core' import { ErrorHandling, ErrorSource } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../../test' +import { setup } from '../../../../test' import type { RawRumErrorEvent } from '../../../rawRumEvent.types' import { RumEventType } from '../../../rawRumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' diff --git a/packages/rum-core/src/domain/rumEventsCollection/error/trackConsoleError.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/error/trackConsoleError.spec.ts index 67bcd0d840..9cbf21ff3a 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/error/trackConsoleError.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/error/trackConsoleError.spec.ts @@ -1,7 +1,7 @@ import type { RawError, Subscription } from '@datadog/browser-core' import { ErrorHandling, ErrorSource, Observable, clocksNow } from '@datadog/browser-core' -import type { Clock } from '../../../../../core/test/specHelper' -import { mockClock } from '../../../../../core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import { trackConsoleError } from './trackConsoleError' describe('trackConsoleError', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts index 2afe69681d..8e13ceafb0 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts @@ -1,8 +1,7 @@ import type { RawError, Subscription } from '@datadog/browser-core' import { ErrorHandling, ErrorSource, Observable, clocksNow } from '@datadog/browser-core' -import type { Clock } from '../../../../../core/test/specHelper' -import { mockClock } from '../../../../../core/test/specHelper' -import { stubReportingObserver } from '../../../../../core/test/stubReportApis' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock, stubReportingObserver } from '@datadog/browser-core/test' import { trackReportError } from './trackReportError' describe('trackReportError', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/longTask/longTaskCollection.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/longTask/longTaskCollection.spec.ts index 272bf23c42..c700d934e7 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/longTask/longTaskCollection.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/longTask/longTaskCollection.spec.ts @@ -1,8 +1,6 @@ import type { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core' -import type { RumSessionManagerMock } from '../../../../test/mockRumSessionManager' -import { createRumSessionManagerMock } from '../../../../test/mockRumSessionManager' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import type { RumSessionManagerMock, TestSetupBuilder } from '../../../../test' +import { createRumSessionManagerMock, setup } from '../../../../test' import type { RumPerformanceEntry, RumPerformanceLongTaskTiming } from '../../../browser/performanceCollection' import { RumEventType } from '../../../rawRumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' diff --git a/packages/rum-core/src/domain/rumEventsCollection/resource/matchRequestTiming.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/resource/matchRequestTiming.spec.ts index c428d6ab5a..90fc7ee3a1 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/resource/matchRequestTiming.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/resource/matchRequestTiming.spec.ts @@ -1,6 +1,6 @@ import type { Duration, RelativeTime } from '@datadog/browser-core' import { isIE, relativeToClocks } from '@datadog/browser-core' -import { createResourceEntry } from '../../../../test/fixtures' +import { createResourceEntry } from '../../../../test' import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection' import type { RequestCompleteEvent } from '../../requestCollection' diff --git a/packages/rum-core/src/domain/rumEventsCollection/resource/resourceCollection.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/resource/resourceCollection.spec.ts index df7cb3517a..1c852f5ac4 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/resource/resourceCollection.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/resource/resourceCollection.spec.ts @@ -8,16 +8,14 @@ import { ResourceType, } from '@datadog/browser-core' import type { RumFetchResourceEventDomainContext } from '../../../domainContext.types' -import { createResourceEntry } from '../../../../test/fixtures' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import { createResourceEntry, setup, createRumSessionManagerMock } from '../../../../test' +import type { TestSetupBuilder } from '../../../../test' import type { RawRumResourceEvent } from '../../../rawRumEvent.types' import { RumEventType } from '../../../rawRumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' import type { RequestCompleteEvent } from '../../requestCollection' import { TraceIdentifier } from '../../tracing/tracer' import { validateAndBuildRumConfiguration } from '../../configuration' -import { createRumSessionManagerMock } from '../../../../test/mockRumSessionManager' import { PageState } from '../../contexts/pageStateHistory' import { startResourceCollection } from './resourceCollection' diff --git a/packages/rum-core/src/domain/rumEventsCollection/resource/resourceUtils.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/resource/resourceUtils.spec.ts index 31fcfed8da..e2f0e3dc59 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/resource/resourceUtils.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/resource/resourceUtils.spec.ts @@ -1,5 +1,5 @@ import type { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core' -import { SPEC_ENDPOINTS } from '../../../../../core/test/specHelper' +import { SPEC_ENDPOINTS } from '@datadog/browser-core/test' import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection' import type { RumConfiguration } from '../../configuration' import { validateAndBuildRumConfiguration } from '../../configuration' diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/setupViewTest.specHelper.ts b/packages/rum-core/src/domain/rumEventsCollection/view/setupViewTest.specHelper.ts index d9ddbc6242..f4fcc70b51 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/setupViewTest.specHelper.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/setupViewTest.specHelper.ts @@ -1,4 +1,4 @@ -import type { BuildContext } from '../../../../test/testSetupBuilder' +import type { BuildContext } from '../../../../test' import { LifeCycleEventType } from '../../lifeCycle' import type { ViewEvent, ViewOptions } from './trackViews' import { trackViews } from './trackViews' diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/trackFirstHidden.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/trackFirstHidden.spec.ts index 88c0731a63..9e1b31e443 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/trackFirstHidden.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/trackFirstHidden.spec.ts @@ -1,6 +1,6 @@ import type { RelativeTime } from '@datadog/browser-core' import { DOM_EVENT } from '@datadog/browser-core' -import { createNewEvent, restorePageVisibility, setPageVisibility } from '../../../../../core/test/specHelper' +import { createNewEvent, restorePageVisibility, setPageVisibility } from '@datadog/browser-core/test' import { resetFirstHidden, trackFirstHidden } from './trackFirstHidden' describe('trackFirstHidden', () => { diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/trackInitialViewTimings.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/trackInitialViewTimings.spec.ts index e4249754e9..9ceb73cdea 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/trackInitialViewTimings.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/trackInitialViewTimings.spec.ts @@ -1,8 +1,8 @@ import type { Duration, RelativeTime } from '@datadog/browser-core' import { DOM_EVENT } from '@datadog/browser-core' -import { createNewEvent, restorePageVisibility, setPageVisibility } from '../../../../../core/test/specHelper' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import { restorePageVisibility, setPageVisibility, createNewEvent } from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../../../test' +import { setup } from '../../../../test' import type { RumFirstInputTiming, RumLargestContentfulPaintTiming, diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/trackViewEventCounts.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/trackViewEventCounts.spec.ts index 54facc04f9..d12de22d51 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/trackViewEventCounts.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/trackViewEventCounts.spec.ts @@ -1,9 +1,9 @@ import type { Context } from '@datadog/browser-core' import { noop } from '@datadog/browser-core' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import type { RumResourceEvent } from '../../../rumEvent.types' import { RumEventType } from '../../../rawRumEvent.types' -import type { Clock } from '../../../../../core/test/specHelper' -import { mockClock } from '../../../../../core/test/specHelper' import { LifeCycle, LifeCycleEventType } from '../../lifeCycle' import { KEEP_TRACKING_EVENT_COUNTS_AFTER_VIEW_DELAY, trackViewEventCounts } from './trackViewEventCounts' diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.spec.ts index 51034b3846..364a6bf672 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.spec.ts @@ -1,8 +1,8 @@ import type { Context, RelativeTime, Duration } from '@datadog/browser-core' import { addDuration, relativeNow } from '@datadog/browser-core' import type { RumEvent } from '../../../rumEvent.types' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../../test' +import { setup } from '../../../../test' import type { RumPerformanceNavigationTiming } from '../../../browser/performanceCollection' import { FrustrationType, RumEventType } from '../../../rawRumEvent.types' import type { LifeCycle } from '../../lifeCycle' diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/trackViews.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/trackViews.spec.ts index 67d60f019c..99988faaea 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/trackViews.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/trackViews.spec.ts @@ -7,8 +7,8 @@ import { relativeNow, resetExperimentalFeatures, } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../../test' +import { setup } from '../../../../test' import type { RumLargestContentfulPaintTiming, RumPerformanceNavigationTiming, diff --git a/packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.spec.ts b/packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.spec.ts index ba15263197..08370f2503 100644 --- a/packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.spec.ts +++ b/packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.spec.ts @@ -1,11 +1,10 @@ import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core' import type { RecorderApi } from '../../../boot/rumPublicApi' -import type { TestSetupBuilder } from '../../../../test/testSetupBuilder' -import { setup } from '../../../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../../../test' +import { setup, noopRecorderApi } from '../../../../test' import type { RawRumViewEvent } from '../../../rawRumEvent.types' import { RumEventType, ViewLoadingType } from '../../../rawRumEvent.types' import { LifeCycleEventType } from '../../lifeCycle' -import { noopRecorderApi } from '../../../../test/noopRecorderApi' import type { ViewEvent } from './trackViews' import { startViewCollection } from './viewCollection' diff --git a/packages/rum-core/src/domain/rumSessionManager.spec.ts b/packages/rum-core/src/domain/rumSessionManager.spec.ts index 2fa8531a70..c59eccbb84 100644 --- a/packages/rum-core/src/domain/rumSessionManager.spec.ts +++ b/packages/rum-core/src/domain/rumSessionManager.spec.ts @@ -8,8 +8,8 @@ import { stopSessionManager, ONE_SECOND, } from '@datadog/browser-core' -import type { Clock } from '../../../core/test/specHelper' -import { mockClock } from '../../../core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' import type { RumConfiguration } from './configuration' import { validateAndBuildRumConfiguration } from './configuration' diff --git a/packages/rum-core/src/domain/startCustomerDataTelemetry.spec.ts b/packages/rum-core/src/domain/startCustomerDataTelemetry.spec.ts index b274d1023e..41ce3c1513 100644 --- a/packages/rum-core/src/domain/startCustomerDataTelemetry.spec.ts +++ b/packages/rum-core/src/domain/startCustomerDataTelemetry.spec.ts @@ -1,7 +1,7 @@ import type { BatchFlushEvent, Context, ContextManager, TelemetryEvent } from '@datadog/browser-core' import { resetExperimentalFeatures, TelemetryService, startTelemetry, Observable } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import type { TestSetupBuilder } from '../../test' +import { setup } from '../../test' import { RumEventType } from '../rawRumEvent.types' import type { RumEvent } from '../rumEvent.types' import type { FeatureFlagContexts } from './contexts/featureFlagContext' diff --git a/packages/rum-core/src/domain/tracing/tracer.spec.ts b/packages/rum-core/src/domain/tracing/tracer.spec.ts index eff8cf0f14..8f0aeee8b7 100644 --- a/packages/rum-core/src/domain/tracing/tracer.spec.ts +++ b/packages/rum-core/src/domain/tracing/tracer.spec.ts @@ -1,8 +1,6 @@ import { display, isIE, objectEntries } from '@datadog/browser-core' -import type { TestSetupBuilder } from '../../../test/testSetupBuilder' -import { setup } from '../../../test/testSetupBuilder' -import type { RumSessionManagerMock } from '../../../test/mockRumSessionManager' -import { createRumSessionManagerMock } from '../../../test/mockRumSessionManager' +import type { TestSetupBuilder, RumSessionManagerMock } from '../../../test' +import { setup, createRumSessionManagerMock } from '../../../test' import type { RumFetchResolveContext, RumFetchStartContext, RumXhrStartContext } from '../requestCollection' import type { RumConfiguration, RumInitConfiguration } from '../configuration' import { validateAndBuildRumConfiguration } from '../configuration' diff --git a/packages/rum-core/src/domain/waitPageActivityEnd.spec.ts b/packages/rum-core/src/domain/waitPageActivityEnd.spec.ts index 2827c3449c..05deee8d19 100644 --- a/packages/rum-core/src/domain/waitPageActivityEnd.spec.ts +++ b/packages/rum-core/src/domain/waitPageActivityEnd.spec.ts @@ -1,9 +1,9 @@ import type { RelativeTime, Subscription } from '@datadog/browser-core' import { Observable, ONE_SECOND, getTimeStamp } from '@datadog/browser-core' -import type { Clock } from '@datadog/browser-core/test/specHelper' -import { mockClock } from '@datadog/browser-core/test/specHelper' -import type { TestSetupBuilder } from '../../test/testSetupBuilder' -import { setup } from '../../test/testSetupBuilder' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock } from '@datadog/browser-core/test' +import type { TestSetupBuilder } from '../../test' +import { setup } from '../../test' import type { RumPerformanceNavigationTiming, RumPerformanceResourceTiming } from '../browser/performanceCollection' import { LifeCycleEventType } from './lifeCycle' import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection' diff --git a/packages/rum-core/test/createFakeClick.ts b/packages/rum-core/test/createFakeClick.ts index 4fc7e4d766..c5eef7adcc 100644 --- a/packages/rum-core/test/createFakeClick.ts +++ b/packages/rum-core/test/createFakeClick.ts @@ -1,5 +1,5 @@ import { clocksNow, Observable, timeStampNow } from '@datadog/browser-core' -import { createNewEvent } from '../../core/test/specHelper' +import { createNewEvent } from '@datadog/browser-core/test' import type { Click } from '../src/domain/rumEventsCollection/action/trackClickActions' export type FakeClick = Readonly> diff --git a/packages/rum-core/test/index.ts b/packages/rum-core/test/index.ts new file mode 100644 index 0000000000..4c1e6ff93c --- /dev/null +++ b/packages/rum-core/test/index.ts @@ -0,0 +1,8 @@ +export * from './createFakeClick' +export * from './createIsolatedDom' +export * from './fixtures' +export * from './formatValidation' +export * from './mockCiVisibilityWindowValues' +export * from './mockRumSessionManager' +export * from './noopRecorderApi' +export * from './testSetupBuilder' diff --git a/packages/rum-core/test/testSetupBuilder.ts b/packages/rum-core/test/testSetupBuilder.ts index f46454280a..c7b499ef15 100644 --- a/packages/rum-core/test/testSetupBuilder.ts +++ b/packages/rum-core/test/testSetupBuilder.ts @@ -1,7 +1,7 @@ import type { Context, ContextManager, TimeStamp } from '@datadog/browser-core' import { assign, combine, createContextManager, noop, Observable } from '@datadog/browser-core' -import type { Clock } from '../../core/test/specHelper' -import { buildLocation, mockClock, SPEC_ENDPOINTS } from '../../core/test/specHelper' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock, buildLocation, SPEC_ENDPOINTS } from '@datadog/browser-core/test' import type { LocationChange } from '../src/browser/locationChangeObservable' import type { RumConfiguration } from '../src/domain/configuration' import { validateAndBuildRumConfiguration } from '../src/domain/configuration' diff --git a/packages/rum/src/boot/recorderApi.spec.ts b/packages/rum/src/boot/recorderApi.spec.ts index 2b7bbecbc7..77598cff30 100644 --- a/packages/rum/src/boot/recorderApi.spec.ts +++ b/packages/rum/src/boot/recorderApi.spec.ts @@ -1,11 +1,9 @@ import { isIE, noop } from '@datadog/browser-core' import type { RecorderApi, ViewContexts, LifeCycle, RumConfiguration } from '@datadog/browser-rum-core' import { LifeCycleEventType } from '@datadog/browser-rum-core' -import { createNewEvent, deleteEventBridgeStub, initEventBridgeStub } from '../../../core/test/specHelper' -import type { RumSessionManagerMock } from '../../../rum-core/test/mockRumSessionManager' -import { createRumSessionManagerMock } from '../../../rum-core/test/mockRumSessionManager' -import type { TestSetupBuilder } from '../../../rum-core/test/testSetupBuilder' -import { setup } from '../../../rum-core/test/testSetupBuilder' +import { deleteEventBridgeStub, initEventBridgeStub, createNewEvent } from '@datadog/browser-core/test' +import type { RumSessionManagerMock, TestSetupBuilder } from '../../../rum-core/test' +import { createRumSessionManagerMock, setup } from '../../../rum-core/test' import type { DeflateWorker, startDeflateWorker } from '../domain/segmentCollection' import type { StartRecording } from './recorderApi' import { makeRecorderApi } from './recorderApi' diff --git a/packages/rum/src/boot/startRecording.spec.ts b/packages/rum/src/boot/startRecording.spec.ts index a2fa925920..45760037e8 100644 --- a/packages/rum/src/boot/startRecording.spec.ts +++ b/packages/rum/src/boot/startRecording.spec.ts @@ -3,19 +3,16 @@ import { PageExitReason, DefaultPrivacyLevel, noop, isIE, timeStampNow } from '@ import type { LifeCycle, ViewCreatedEvent } from '@datadog/browser-rum-core' import { LifeCycleEventType } from '@datadog/browser-rum-core' import { inflate } from 'pako' -import type { RumSessionManagerMock } from '../../../rum-core/test/mockRumSessionManager' -import { createRumSessionManagerMock } from '../../../rum-core/test/mockRumSessionManager' -import { createNewEvent, mockClock } from '../../../core/test/specHelper' +import { collectAsyncCalls, createNewEvent, mockClock } from '@datadog/browser-core/test' +import type { RumSessionManagerMock, TestSetupBuilder } from '../../../rum-core/test' +import { createRumSessionManagerMock, setup } from '../../../rum-core/test' -import type { TestSetupBuilder } from '../../../rum-core/test/testSetupBuilder' -import { setup } from '../../../rum-core/test/testSetupBuilder' -import { recordsPerFullSnapshot } from '../../test/utils' +import { recordsPerFullSnapshot } from '../../test' import { setSegmentBytesLimit, startDeflateWorker } from '../domain/segmentCollection' import type { BrowserSegment } from '../types' import { RecordType } from '../types' import { resetReplayStats } from '../domain/replayStats' -import { collectAsyncCalls } from '../../../core/test/collectAsyncCalls' import { startRecording } from './startRecording' const VIEW_TIMESTAMP = 1 as TimeStamp diff --git a/packages/rum/src/domain/record/mutationBatch.spec.ts b/packages/rum/src/domain/record/mutationBatch.spec.ts index c49995995e..66240d14dc 100644 --- a/packages/rum/src/domain/record/mutationBatch.spec.ts +++ b/packages/rum/src/domain/record/mutationBatch.spec.ts @@ -1,4 +1,4 @@ -import { collectAsyncCalls } from '../../../../core/test/collectAsyncCalls' +import { collectAsyncCalls } from '@datadog/browser-core/test' import { createMutationBatch } from './mutationBatch' import type { RumMutationRecord } from './observers' diff --git a/packages/rum/src/domain/record/observers/inputObserver.spec.ts b/packages/rum/src/domain/record/observers/inputObserver.spec.ts index e1465c3d0d..5aeb317321 100644 --- a/packages/rum/src/domain/record/observers/inputObserver.spec.ts +++ b/packages/rum/src/domain/record/observers/inputObserver.spec.ts @@ -1,9 +1,9 @@ import { DefaultPrivacyLevel, isIE } from '@datadog/browser-core' -import { createNewEvent } from '@datadog/browser-core/test/specHelper' +import { createNewEvent } from '@datadog/browser-core/test' import { PRIVACY_ATTR_NAME, PRIVACY_ATTR_VALUE_MASK_USER_INPUT } from '../../../constants' import { serializeDocument, SerializationContextStatus } from '../serialization' import { createElementsScrollPositions } from '../elementsScrollPositions' -import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test/utils' +import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test' import type { InputCallback } from './inputObserver' import { initInputObserver } from './inputObserver' diff --git a/packages/rum/src/domain/record/observers/mouseInteractionObserver.spec.ts b/packages/rum/src/domain/record/observers/mouseInteractionObserver.spec.ts index 89827b4a22..f876387b7d 100644 --- a/packages/rum/src/domain/record/observers/mouseInteractionObserver.spec.ts +++ b/packages/rum/src/domain/record/observers/mouseInteractionObserver.spec.ts @@ -1,9 +1,9 @@ import { DefaultPrivacyLevel, isIE } from '@datadog/browser-core' -import { createNewEvent } from '@datadog/browser-core/test/specHelper' +import { createNewEvent } from '@datadog/browser-core/test' import { IncrementalSource, MouseInteractionType, RecordType } from '../../../types' import { serializeDocument, SerializationContextStatus } from '../serialization' import { createElementsScrollPositions } from '../elementsScrollPositions' -import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test/utils' +import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test' import type { MouseInteractionCallBack } from './mouseInteractionObserver' import { initMouseInteractionObserver } from './mouseInteractionObserver' import type { RecordIds } from './recordIds' diff --git a/packages/rum/src/domain/record/observers/moveObserver.spec.ts b/packages/rum/src/domain/record/observers/moveObserver.spec.ts index ffb23ddc23..18c463c634 100644 --- a/packages/rum/src/domain/record/observers/moveObserver.spec.ts +++ b/packages/rum/src/domain/record/observers/moveObserver.spec.ts @@ -1,9 +1,9 @@ import { isIE } from '@datadog/browser-core' -import { createNewEvent } from '@datadog/browser-core/test/specHelper' +import { createNewEvent } from '@datadog/browser-core/test' import { SerializationContextStatus, serializeDocument } from '../serialization' import { createElementsScrollPositions } from '../elementsScrollPositions' import { IncrementalSource } from '../../../types' -import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test/utils' +import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test' import type { MousemoveCallBack } from './moveObserver' import { initMoveObserver } from './moveObserver' diff --git a/packages/rum/src/domain/record/observers/mutationObserver.spec.ts b/packages/rum/src/domain/record/observers/mutationObserver.spec.ts index 1b831e435c..54026c8d05 100644 --- a/packages/rum/src/domain/record/observers/mutationObserver.spec.ts +++ b/packages/rum/src/domain/record/observers/mutationObserver.spec.ts @@ -1,7 +1,7 @@ import { DefaultPrivacyLevel, isIE } from '@datadog/browser-core' import type { RumConfiguration } from '@datadog/browser-rum-core' -import { collectAsyncCalls } from '@datadog/browser-core/test/collectAsyncCalls' -import { createMutationPayloadValidator, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test/utils' +import { collectAsyncCalls } from '@datadog/browser-core/test' +import { createMutationPayloadValidator, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test' import { NodePrivacyLevel, PRIVACY_ATTR_NAME, diff --git a/packages/rum/src/domain/record/observers/styleSheetObserver.spec.ts b/packages/rum/src/domain/record/observers/styleSheetObserver.spec.ts index cf6783ab66..751beeee34 100644 --- a/packages/rum/src/domain/record/observers/styleSheetObserver.spec.ts +++ b/packages/rum/src/domain/record/observers/styleSheetObserver.spec.ts @@ -1,6 +1,6 @@ import { isIE } from '@datadog/browser-core' -import { isFirefox } from '@datadog/browser-core/test/specHelper' -import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test/utils' +import { isFirefox } from '@datadog/browser-core/test' +import { DEFAULT_CONFIGURATION, DEFAULT_SHADOW_ROOT_CONTROLLER } from '../../../../test' import { serializeDocument, SerializationContextStatus } from '../serialization' import { createElementsScrollPositions } from '../elementsScrollPositions' import type { StyleSheetCallback } from './styleSheetObserver' diff --git a/packages/rum/src/domain/record/record.spec.ts b/packages/rum/src/domain/record/record.spec.ts index 0a00483492..c43d8b6103 100644 --- a/packages/rum/src/domain/record/record.spec.ts +++ b/packages/rum/src/domain/record/record.spec.ts @@ -1,10 +1,9 @@ import { DefaultPrivacyLevel, findLast, isIE } from '@datadog/browser-core' import type { RumConfiguration } from '@datadog/browser-rum-core' import { LifeCycle } from '@datadog/browser-rum-core' -import { collectAsyncCalls } from '../../../../core/test/collectAsyncCalls' -import type { Clock } from '../../../../core/test/specHelper' -import { createNewEvent } from '../../../../core/test/specHelper' -import { findFullSnapshot, findNode, recordsPerFullSnapshot } from '../../../test/utils' +import type { Clock } from '@datadog/browser-core/test' +import { createNewEvent, collectAsyncCalls } from '@datadog/browser-core/test' +import { findFullSnapshot, findNode, recordsPerFullSnapshot } from '../../../test' import type { BrowserIncrementalSnapshotRecord, BrowserMutationData, diff --git a/packages/rum/src/domain/record/serialization/serializeNode.spec.ts b/packages/rum/src/domain/record/serialization/serializeNode.spec.ts index 563aa545a2..75444655ea 100644 --- a/packages/rum/src/domain/record/serialization/serializeNode.spec.ts +++ b/packages/rum/src/domain/record/serialization/serializeNode.spec.ts @@ -1,6 +1,7 @@ import { isIE, noop } from '@datadog/browser-core' import type { RumConfiguration } from '@datadog/browser-rum-core' +import { isAdoptedStyleSheetsSupported } from '@datadog/browser-core/test' import { NodePrivacyLevel, PRIVACY_ATTR_NAME, @@ -11,12 +12,11 @@ import { } from '../../../constants' import type { ElementNode, SerializedNodeWithId, TextNode } from '../../../types' import { NodeType } from '../../../types' -import type { IsolatedDom } from '../../../../../rum-core/test/createIsolatedDom' -import { createIsolatedDom } from '../../../../../rum-core/test/createIsolatedDom' +import type { IsolatedDom } from '../../../../../rum-core/test' +import { createIsolatedDom } from '../../../../../rum-core/test' import type { ElementsScrollPositions } from '../elementsScrollPositions' import { createElementsScrollPositions } from '../elementsScrollPositions' import type { ShadowRootCallBack, ShadowRootsController } from '../shadowRootsController' -import { isAdoptedStyleSheetsSupported } from '../../../../../core/test/specHelper' import { HTML, generateLeanSerializedDoc, diff --git a/packages/rum/src/domain/record/serialization/serializeStyleSheets.spec.ts b/packages/rum/src/domain/record/serialization/serializeStyleSheets.spec.ts index bded22814a..ae4f621bb0 100644 --- a/packages/rum/src/domain/record/serialization/serializeStyleSheets.spec.ts +++ b/packages/rum/src/domain/record/serialization/serializeStyleSheets.spec.ts @@ -1,4 +1,4 @@ -import { isAdoptedStyleSheetsSupported } from '@datadog/browser-core/test/specHelper' +import { isAdoptedStyleSheetsSupported } from '@datadog/browser-core/test' import { serializeStyleSheets } from './serializeStyleSheets' describe('serializeStyleSheets', () => { diff --git a/packages/rum/src/domain/segmentCollection/segment.spec.ts b/packages/rum/src/domain/segmentCollection/segment.spec.ts index 2beaaaa993..3a0656149b 100644 --- a/packages/rum/src/domain/segmentCollection/segment.spec.ts +++ b/packages/rum/src/domain/segmentCollection/segment.spec.ts @@ -1,6 +1,6 @@ import type { TimeStamp } from '@datadog/browser-core' import { noop, setDebugMode, display, isIE } from '@datadog/browser-core' -import { MockWorker, parseSegment } from '../../../test/utils' +import { MockWorker, parseSegment } from '../../../test' import type { CreationReason, BrowserRecord, SegmentContext } from '../../types' import { RecordType } from '../../types' import { getReplayStats, resetReplayStats } from '../replayStats' diff --git a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts index dfce42507a..41ac91f9ab 100644 --- a/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts +++ b/packages/rum/src/domain/segmentCollection/segmentCollection.spec.ts @@ -2,12 +2,12 @@ import type { HttpRequest, TimeStamp } from '@datadog/browser-core' import { PageExitReason, isIE } from '@datadog/browser-core' import type { ViewContexts, ViewContext } from '@datadog/browser-rum-core' import { LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core' -import type { Clock } from '@datadog/browser-core/test/specHelper' -import { mockClock, restorePageVisibility } from '@datadog/browser-core/test/specHelper' -import { createRumSessionManagerMock } from '../../../../rum-core/test/mockRumSessionManager' +import type { Clock } from '@datadog/browser-core/test' +import { mockClock, restorePageVisibility } from '@datadog/browser-core/test' +import { createRumSessionManagerMock } from '../../../../rum-core/test' import type { BrowserRecord, SegmentContext } from '../../types' import { RecordType } from '../../types' -import { MockWorker } from '../../../test/utils' +import { MockWorker } from '../../../test' import { computeSegmentContext, doStartSegmentCollection, diff --git a/packages/rum/src/domain/segmentCollection/startDeflateWorker.spec.ts b/packages/rum/src/domain/segmentCollection/startDeflateWorker.spec.ts index c0dc857da0..b3e1ea8ea4 100644 --- a/packages/rum/src/domain/segmentCollection/startDeflateWorker.spec.ts +++ b/packages/rum/src/domain/segmentCollection/startDeflateWorker.spec.ts @@ -1,6 +1,6 @@ import type { RawTelemetryEvent } from '@datadog/browser-core' import { display, isIE, noop, resetTelemetry, startFakeTelemetry } from '@datadog/browser-core' -import { MockWorker } from '../../../test/utils' +import { MockWorker } from '../../../test' import type { createDeflateWorker } from './deflateWorker' import { startDeflateWorker, resetDeflateWorkerState } from './startDeflateWorker' diff --git a/packages/rum/test/index.ts b/packages/rum/test/index.ts new file mode 100644 index 0000000000..9c56149efa --- /dev/null +++ b/packages/rum/test/index.ts @@ -0,0 +1 @@ +export * from './utils' diff --git a/test/e2e/scenario/recorder/recorder.scenario.ts b/test/e2e/scenario/recorder/recorder.scenario.ts index 1ad26d4598..36768309f2 100644 --- a/test/e2e/scenario/recorder/recorder.scenario.ts +++ b/test/e2e/scenario/recorder/recorder.scenario.ts @@ -22,7 +22,7 @@ import { findAllFrustrationRecords, findMouseInteractionRecords, findElementWithTagName, -} from '@datadog/browser-rum/test/utils' +} from '@datadog/browser-rum/test' import { flushEvents, createTest, bundleSetup, html } from '../../lib/framework' import { browserExecute, browserExecuteAsync } from '../../lib/helpers/browser' import { getFirstSegment, getLastSegment, initRumAndStartRecording } from '../../lib/helpers/replay' diff --git a/test/e2e/scenario/recorder/shadowDom.scenario.ts b/test/e2e/scenario/recorder/shadowDom.scenario.ts index 222178b968..b01f4ed545 100644 --- a/test/e2e/scenario/recorder/shadowDom.scenario.ts +++ b/test/e2e/scenario/recorder/shadowDom.scenario.ts @@ -11,13 +11,13 @@ import { findNode, findTextContent, findTextNode, -} from '@datadog/browser-rum/test/utils' +} from '@datadog/browser-rum/test' import type { EventRegistry } from '../../lib/framework' import { flushEvents, createTest, bundleSetup, html } from '../../lib/framework' import { browserExecute } from '../../lib/helpers/browser' -/** Will generate the following HTML +/** Will generate the following HTML * ```html * * #shadow-root @@ -57,7 +57,7 @@ const inputShadowDom = ` ` -/** Will generate the following HTML +/** Will generate the following HTML * ```html * * #shadow-root @@ -82,7 +82,7 @@ const divShadowDom = ` ` -/** Will generate the following HTML +/** Will generate the following HTML * ```html * * #shadow-root diff --git a/test/e2e/scenario/recorder/viewports.scenario.ts b/test/e2e/scenario/recorder/viewports.scenario.ts index e4e333febb..be0caa5eee 100644 --- a/test/e2e/scenario/recorder/viewports.scenario.ts +++ b/test/e2e/scenario/recorder/viewports.scenario.ts @@ -2,7 +2,7 @@ import type { ViewportResizeData, ScrollData } from '@datadog/browser-rum/cjs/ty import { IncrementalSource } from '@datadog/browser-rum/cjs/types' import type { RumInitConfiguration } from '@datadog/browser-rum-core' -import { findAllIncrementalSnapshots, findAllVisualViewports } from '@datadog/browser-rum/test/utils' +import { findAllIncrementalSnapshots, findAllVisualViewports } from '@datadog/browser-rum/test' import type { EventRegistry } from '../../lib/framework' import { flushEvents, createTest, bundleSetup, html } from '../../lib/framework' import { browserExecute, getBrowserName, getPlatformName } from '../../lib/helpers/browser'