Skip to content

Commit ce9b218

Browse files
committed
test(replay): Stop using @test imports
For symmetry with the other packages, just use proper import paths.
1 parent 711bb7d commit ce9b218

17 files changed

+27
-44
lines changed

packages/replay/.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ module.exports = {
6060
files: ['test/**/*.ts'],
6161

6262
rules: {
63-
// TODO: decide if we want to keep our '@test' import paths
64-
'import/no-unresolved': 'off',
6563
// most of these errors come from `new Promise(process.nextTick)`
6664
'@typescript-eslint/unbound-method': 'off',
6765
// TODO: decide if we want to enable this again after the migration

packages/replay/jest.config.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import type { Config } from '@jest/types';
2-
import { pathsToModuleNameMapper } from 'ts-jest';
32
import { jsWithTs as jsWithTsPreset } from 'ts-jest/presets';
43

5-
import { compilerOptions } from './tsconfig.test.json';
6-
74
export default async (): Promise<Config.InitialOptions> => {
85
return {
96
...jsWithTsPreset,
@@ -14,9 +11,6 @@ export default async (): Promise<Config.InitialOptions> => {
1411
},
1512
__DEBUG_BUILD__: true,
1613
},
17-
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
18-
prefix: '<rootDir>/',
19-
}),
2014
setupFilesAfterEnv: ['./jest.setup.ts'],
2115
testEnvironment: 'jsdom',
2216
testMatch: ['<rootDir>/test/**/*(*.)@(spec|test).ts'],

packages/replay/test/mocks/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getCurrentHub } from '@sentry/core';
2-
import { BASE_TIMESTAMP, RecordMock } from '@test';
3-
import { DomHandler, MockTransportSend } from '@test/types';
4-
import { Replay } from 'src';
52

63
import { ReplayConfiguration } from '../../src/types';
4+
import { BASE_TIMESTAMP, RecordMock } from './..';
5+
import { Replay } from './../../src';
6+
import { DomHandler, MockTransportSend } from './../types';
77

88
export async function resetSdkMock(options?: ReplayConfiguration): Promise<{
99
domHandler: DomHandler;

packages/replay/test/unit/coreHandlers/handleFetch.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { mockSdk } from '@test';
2-
31
import { handleFetch } from '../../../src/coreHandlers/handleFetch';
2+
import { mockSdk } from './../..';
43

54
jest.unmock('@sentry/browser');
65

packages/replay/test/unit/coreHandlers/handleScope-unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getCurrentHub } from '@sentry/core';
2-
import { mockSdk } from '@test';
32

43
import * as HandleScope from '../../../src/coreHandlers/handleScope';
4+
import { mockSdk } from './../..';
55

66
let mockHandleScope: jest.MockedFunction<typeof HandleScope.handleScope>;
77

packages/replay/test/unit/createPerformanceEntry.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { mockSdk } from '@test';
2-
31
import { createPerformanceEntries } from '../../src/createPerformanceEntry';
2+
import { mockSdk } from './..';
43

54
jest.unmock('@sentry/browser');
65

packages/replay/test/unit/eventBuffer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'jsdom-worker';
22

3-
import { BASE_TIMESTAMP } from '@test';
43
import pako from 'pako';
54

5+
import { BASE_TIMESTAMP } from './..';
66
import { createEventBuffer, EventBufferCompressionWorker } from './../../src/eventBuffer';
77

88
const TEST_EVENT = { data: {}, timestamp: BASE_TIMESTAMP, type: 3 };

packages/replay/test/unit/flush.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as SentryUtils from '@sentry/utils';
2-
import { BASE_TIMESTAMP, mockRrweb, mockSdk } from '@test';
32

43
import { SESSION_IDLE_DURATION, WINDOW } from '../../src/constants';
4+
import { BASE_TIMESTAMP, mockRrweb, mockSdk } from './..';
55
import { Replay } from './../../src';
66
import { createPerformanceEntries } from './../../src/createPerformanceEntry';
77
import { useFakeTimers } from './../../test/utils/use-fake-timers';

packages/replay/test/unit/index-errorSampleRate.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
jest.unmock('@sentry/browser');
22

33
import { captureException } from '@sentry/browser';
4-
import { BASE_TIMESTAMP, RecordMock } from '@test';
5-
import { PerformanceEntryResource } from '@test/fixtures/performanceEntry/resource';
6-
import { resetSdkMock } from '@test/mocks';
7-
import { DomHandler, MockTransportSend } from '@test/types';
84

95
import { REPLAY_SESSION_KEY, VISIBILITY_CHANGE_TIMEOUT, WINDOW } from '../../src/constants';
6+
import { BASE_TIMESTAMP, RecordMock } from './..';
107
import { Replay } from './../../src';
8+
import { PerformanceEntryResource } from './../fixtures/performanceEntry/resource';
9+
import { resetSdkMock } from './../mocks';
10+
import { DomHandler, MockTransportSend } from './../types';
1111
import { useFakeTimers } from './../utils/use-fake-timers';
1212

1313
useFakeTimers();

packages/replay/test/unit/index-handleGlobalEvent.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { getCurrentHub } from '@sentry/core';
2-
import { Error } from '@test/fixtures/error';
3-
import { Transaction } from '@test/fixtures/transaction';
4-
import { resetSdkMock } from '@test/mocks';
52

63
import { REPLAY_EVENT_NAME } from '../../src/constants';
74
import { Replay } from './../../src';
5+
import { Error } from './../fixtures/error';
6+
import { Transaction } from './../fixtures/transaction';
7+
import { resetSdkMock } from './../mocks';
88
import { useFakeTimers } from './../utils/use-fake-timers';
99

1010
useFakeTimers();

0 commit comments

Comments
 (0)