diff --git a/.vscode/settings.json b/.vscode/settings.json index 82e3bc618c58..30ea95c5e635 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,9 @@ "search.exclude": { "**/node_modules/": true, "**/build/": true, - "**/dist/": true + "**/dist/": true, + "**/coverage/": true, + "**/yarn-error.log": true }, "typescript.tsdk": "./node_modules/typescript/lib", "[json]": { diff --git a/packages/replay/.eslintrc.js b/packages/replay/.eslintrc.js index 96c1cc5057b5..908f9e17120e 100644 --- a/packages/replay/.eslintrc.js +++ b/packages/replay/.eslintrc.js @@ -60,8 +60,6 @@ module.exports = { files: ['test/**/*.ts'], rules: { - // TODO: decide if we want to keep our '@test' import paths - 'import/no-unresolved': 'off', // most of these errors come from `new Promise(process.nextTick)` '@typescript-eslint/unbound-method': 'off', // TODO: decide if we want to enable this again after the migration diff --git a/packages/replay/jest.config.ts b/packages/replay/jest.config.ts index e2a463b055a1..90a3cf471f8d 100644 --- a/packages/replay/jest.config.ts +++ b/packages/replay/jest.config.ts @@ -1,22 +1,15 @@ import type { Config } from '@jest/types'; -import { pathsToModuleNameMapper } from 'ts-jest'; import { jsWithTs as jsWithTsPreset } from 'ts-jest/presets'; -import { compilerOptions } from './tsconfig.test.json'; - export default async (): Promise => { return { ...jsWithTsPreset, - verbose: true, globals: { 'ts-jest': { tsconfig: '/tsconfig.test.json', }, __DEBUG_BUILD__: true, }, - moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { - prefix: '/', - }), setupFilesAfterEnv: ['./jest.setup.ts'], testEnvironment: 'jsdom', testMatch: ['/test/**/*(*.)@(spec|test).ts'], diff --git a/packages/replay/test/mocks/index.ts b/packages/replay/test/mocks/index.ts index c744a4c6a6de..f22600431557 100644 --- a/packages/replay/test/mocks/index.ts +++ b/packages/replay/test/mocks/index.ts @@ -1,9 +1,9 @@ import { getCurrentHub } from '@sentry/core'; -import { BASE_TIMESTAMP, RecordMock } from '@test'; -import { DomHandler, MockTransportSend } from '@test/types'; -import { Replay } from 'src'; import { ReplayConfiguration } from '../../src/types'; +import { Replay } from './../../src'; +import { BASE_TIMESTAMP, RecordMock } from './../index'; +import { DomHandler, MockTransportSend } from './../types'; export async function resetSdkMock(options?: ReplayConfiguration): Promise<{ domHandler: DomHandler; diff --git a/packages/replay/test/unit/coreHandlers/handleFetch.test.ts b/packages/replay/test/unit/coreHandlers/handleFetch.test.ts index 49662ef9b056..2cd9411cfb2e 100644 --- a/packages/replay/test/unit/coreHandlers/handleFetch.test.ts +++ b/packages/replay/test/unit/coreHandlers/handleFetch.test.ts @@ -1,6 +1,5 @@ -import { mockSdk } from '@test'; - import { handleFetch } from '../../../src/coreHandlers/handleFetch'; +import { mockSdk } from './../../index'; jest.unmock('@sentry/browser'); diff --git a/packages/replay/test/unit/coreHandlers/handleScope-unit.test.ts b/packages/replay/test/unit/coreHandlers/handleScope-unit.test.ts index f70420d2613f..cec834472029 100644 --- a/packages/replay/test/unit/coreHandlers/handleScope-unit.test.ts +++ b/packages/replay/test/unit/coreHandlers/handleScope-unit.test.ts @@ -1,7 +1,7 @@ import { getCurrentHub } from '@sentry/core'; -import { mockSdk } from '@test'; import * as HandleScope from '../../../src/coreHandlers/handleScope'; +import { mockSdk } from './../../index'; let mockHandleScope: jest.MockedFunction; diff --git a/packages/replay/test/unit/createPerformanceEntry.test.ts b/packages/replay/test/unit/createPerformanceEntry.test.ts index dfe0278d5bb0..d6bbf7e36b32 100644 --- a/packages/replay/test/unit/createPerformanceEntry.test.ts +++ b/packages/replay/test/unit/createPerformanceEntry.test.ts @@ -1,6 +1,5 @@ -import { mockSdk } from '@test'; - import { createPerformanceEntries } from '../../src/createPerformanceEntry'; +import { mockSdk } from './../index'; jest.unmock('@sentry/browser'); diff --git a/packages/replay/test/unit/eventBuffer.test.ts b/packages/replay/test/unit/eventBuffer.test.ts index 86e3ec3a940a..a34230138fea 100644 --- a/packages/replay/test/unit/eventBuffer.test.ts +++ b/packages/replay/test/unit/eventBuffer.test.ts @@ -1,9 +1,9 @@ import 'jsdom-worker'; -import { BASE_TIMESTAMP } from '@test'; import pako from 'pako'; import { createEventBuffer, EventBufferCompressionWorker } from './../../src/eventBuffer'; +import { BASE_TIMESTAMP } from './../index'; const TEST_EVENT = { data: {}, timestamp: BASE_TIMESTAMP, type: 3 }; diff --git a/packages/replay/test/unit/flush.test.ts b/packages/replay/test/unit/flush.test.ts index 2b8c05c58696..bfb527557bfd 100644 --- a/packages/replay/test/unit/flush.test.ts +++ b/packages/replay/test/unit/flush.test.ts @@ -1,10 +1,10 @@ import * as SentryUtils from '@sentry/utils'; -import { BASE_TIMESTAMP, mockRrweb, mockSdk } from '@test'; import { SESSION_IDLE_DURATION, WINDOW } from '../../src/constants'; import { Replay } from './../../src'; import { createPerformanceEntries } from './../../src/createPerformanceEntry'; import { useFakeTimers } from './../../test/utils/use-fake-timers'; +import { BASE_TIMESTAMP, mockRrweb, mockSdk } from './../index'; useFakeTimers(); diff --git a/packages/replay/test/unit/index-errorSampleRate.test.ts b/packages/replay/test/unit/index-errorSampleRate.test.ts index b653d772be99..3c6f393de50e 100644 --- a/packages/replay/test/unit/index-errorSampleRate.test.ts +++ b/packages/replay/test/unit/index-errorSampleRate.test.ts @@ -1,13 +1,13 @@ jest.unmock('@sentry/browser'); import { captureException } from '@sentry/browser'; -import { BASE_TIMESTAMP, RecordMock } from '@test'; -import { PerformanceEntryResource } from '@test/fixtures/performanceEntry/resource'; -import { resetSdkMock } from '@test/mocks'; -import { DomHandler, MockTransportSend } from '@test/types'; import { REPLAY_SESSION_KEY, VISIBILITY_CHANGE_TIMEOUT, WINDOW } from '../../src/constants'; import { Replay } from './../../src'; +import { PerformanceEntryResource } from './../fixtures/performanceEntry/resource'; +import { BASE_TIMESTAMP, RecordMock } from './../index'; +import { resetSdkMock } from './../mocks'; +import { DomHandler, MockTransportSend } from './../types'; import { useFakeTimers } from './../utils/use-fake-timers'; useFakeTimers(); diff --git a/packages/replay/test/unit/index-handleGlobalEvent.test.ts b/packages/replay/test/unit/index-handleGlobalEvent.test.ts index 41b2e1bf13cb..0d5a05f6c602 100644 --- a/packages/replay/test/unit/index-handleGlobalEvent.test.ts +++ b/packages/replay/test/unit/index-handleGlobalEvent.test.ts @@ -1,10 +1,10 @@ import { getCurrentHub } from '@sentry/core'; -import { Error } from '@test/fixtures/error'; -import { Transaction } from '@test/fixtures/transaction'; -import { resetSdkMock } from '@test/mocks'; import { REPLAY_EVENT_NAME } from '../../src/constants'; import { Replay } from './../../src'; +import { Error } from './../fixtures/error'; +import { Transaction } from './../fixtures/transaction'; +import { resetSdkMock } from './../mocks'; import { useFakeTimers } from './../utils/use-fake-timers'; useFakeTimers(); diff --git a/packages/replay/test/unit/index-integrationSettings.test.ts b/packages/replay/test/unit/index-integrationSettings.test.ts index 2eeb0e5d0951..40a20ed41e72 100644 --- a/packages/replay/test/unit/index-integrationSettings.test.ts +++ b/packages/replay/test/unit/index-integrationSettings.test.ts @@ -1,6 +1,5 @@ -import { mockSdk } from '@test'; - import { Replay } from '../../src'; +import { mockSdk } from './../index'; let replay: Replay; diff --git a/packages/replay/test/unit/index-noSticky.test.ts b/packages/replay/test/unit/index-noSticky.test.ts index c756a770c038..6ddbc579edeb 100644 --- a/packages/replay/test/unit/index-noSticky.test.ts +++ b/packages/replay/test/unit/index-noSticky.test.ts @@ -1,10 +1,10 @@ import { getCurrentHub } from '@sentry/core'; import { Transport } from '@sentry/types'; import * as SentryUtils from '@sentry/utils'; -import { BASE_TIMESTAMP, mockRrweb, mockSdk } from '@test'; import { SESSION_IDLE_DURATION, VISIBILITY_CHANGE_TIMEOUT } from '../../src/constants'; import { Replay } from './../../src'; +import { BASE_TIMESTAMP, mockRrweb, mockSdk } from './../index'; import { useFakeTimers } from './../utils/use-fake-timers'; useFakeTimers(); diff --git a/packages/replay/test/unit/index-sampling.test.ts b/packages/replay/test/unit/index-sampling.test.ts index 507dceca5457..55f42b88bbfc 100644 --- a/packages/replay/test/unit/index-sampling.test.ts +++ b/packages/replay/test/unit/index-sampling.test.ts @@ -1,8 +1,7 @@ jest.unmock('@sentry/browser'); // mock functions need to be imported first -import { mockRrweb, mockSdk } from '@test'; - +import { mockRrweb, mockSdk } from './../index'; import { useFakeTimers } from './../utils/use-fake-timers'; useFakeTimers(); diff --git a/packages/replay/test/unit/index.test.ts b/packages/replay/test/unit/index.test.ts index 22da701f150c..9f3b48a3fc73 100644 --- a/packages/replay/test/unit/index.test.ts +++ b/packages/replay/test/unit/index.test.ts @@ -1,16 +1,16 @@ jest.mock('./../../src/util/isInternal', () => ({ isInternal: jest.fn(() => true), })); -import { BASE_TIMESTAMP, RecordMock } from '@test'; -import { PerformanceEntryResource } from '@test/fixtures/performanceEntry/resource'; -import { resetSdkMock } from '@test/mocks'; -import { DomHandler, MockTransportSend } from '@test/types'; import { EventType } from 'rrweb'; import { Replay } from '../../src'; import { MAX_SESSION_LIFE, REPLAY_SESSION_KEY, VISIBILITY_CHANGE_TIMEOUT, WINDOW } from '../../src/constants'; import { RecordingEvent } from '../../src/types'; import { useFakeTimers } from '../utils/use-fake-timers'; +import { PerformanceEntryResource } from './../fixtures/performanceEntry/resource'; +import { BASE_TIMESTAMP, RecordMock } from './../index'; +import { resetSdkMock } from './../mocks'; +import { DomHandler, MockTransportSend } from './../types'; useFakeTimers(); diff --git a/packages/replay/test/unit/stop.test.ts b/packages/replay/test/unit/stop.test.ts index bcc3c396c5fd..13f4a737a670 100644 --- a/packages/replay/test/unit/stop.test.ts +++ b/packages/replay/test/unit/stop.test.ts @@ -1,9 +1,9 @@ import * as SentryUtils from '@sentry/utils'; -// mock functions need to be imported first -import { BASE_TIMESTAMP, mockRrweb, mockSdk } from '@test'; import { SESSION_IDLE_DURATION, WINDOW } from '../../src/constants'; import { Replay } from './../../src'; +// mock functions need to be imported first +import { BASE_TIMESTAMP, mockRrweb, mockSdk } from './../index'; import { useFakeTimers } from './../utils/use-fake-timers'; useFakeTimers(); diff --git a/packages/replay/test/unit/util/dedupePerformanceEntries.test.ts b/packages/replay/test/unit/util/dedupePerformanceEntries.test.ts index 9a7387f7960d..15e66421829b 100644 --- a/packages/replay/test/unit/util/dedupePerformanceEntries.test.ts +++ b/packages/replay/test/unit/util/dedupePerformanceEntries.test.ts @@ -1,9 +1,8 @@ // eslint-disable-next-line import/no-unresolved -import { PerformanceEntryLcp } from '@test/fixtures/performanceEntry/lcp'; -import { PerformanceEntryNavigation } from '@test/fixtures/performanceEntry/navigation'; -import { PerformanceEntryResource } from '@test/fixtures/performanceEntry/resource'; - import { dedupePerformanceEntries } from '../../../src/util/dedupePerformanceEntries'; +import { PerformanceEntryLcp } from './../../fixtures/performanceEntry/lcp'; +import { PerformanceEntryNavigation } from './../../fixtures/performanceEntry/navigation'; +import { PerformanceEntryResource } from './../../fixtures/performanceEntry/resource'; it('does nothing with a single entry', function () { const entries = [PerformanceEntryNavigation()]; diff --git a/packages/replay/tsconfig.json b/packages/replay/tsconfig.json index e936e6993f43..f8f54556da93 100644 --- a/packages/replay/tsconfig.json +++ b/packages/replay/tsconfig.json @@ -1,16 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "esnext", - "noImplicitAny": true, - "noEmitOnError": false, - "esModuleInterop": true, - "resolveJsonModule": true, - "allowJs": true, - "declaration": true, - "declarationMap": true, - "strictNullChecks": true + "module": "esnext" }, - "include": ["src/**/*.ts"], - "exclude": ["node_modules"] + "include": ["src/**/*.ts"] } diff --git a/packages/replay/tsconfig.test.json b/packages/replay/tsconfig.test.json index ec76a39e4ffb..ad87caa06c48 100644 --- a/packages/replay/tsconfig.test.json +++ b/packages/replay/tsconfig.test.json @@ -4,17 +4,12 @@ "include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"], "compilerOptions": { - "paths": { - "@test": ["./test"], - "@test/*": ["./test/*"] - }, - "baseUrl": ".", - "rootDir": ".", "types": ["node", "jest"], - "noImplicitAny": false, + "esModuleInterop": true, + "allowJs": true, + "noImplicitAny": true, "noImplicitThis": false, - "strictPropertyInitialization": false, - "resolveJsonModule": true, - "allowJs": true + "strictNullChecks": true, + "strictPropertyInitialization": false } }