Skip to content

Commit ceca10e

Browse files
committed
lint
1 parent 83162b6 commit ceca10e

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

packages/replay-internal/test.setup.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { vi } from 'vitest';
2-
import type { Assertion, AsymmetricMatchersContaining, Mocked, MockedFunction } from 'vitest';
2+
import type { Mocked, MockedFunction } from 'vitest';
33
import { printDiffOrStringify } from 'jest-matcher-utils';
44

55
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
@@ -101,6 +101,7 @@ function checkCallForSentReplay(
101101
: (expected as SentReplayExpected);
102102

103103
if (isObjectContaining) {
104+
// eslint-disable-next-line no-console
104105
console.warn('`expect.objectContaining` is unnecessary when using the `toHaveSentReplay` matcher');
105106
}
106107

@@ -242,18 +243,13 @@ expect.extend({
242243
toHaveLastSentReplay,
243244
});
244245

245-
declare global {
246-
// eslint-disable-next-line @typescript-eslint/no-namespace
247-
namespace vi {
248-
interface AsymmetricMatchers {
249-
toHaveSentReplay(expected?: SentReplayExpected): void;
250-
toHaveLastSentReplay(expected?: SentReplayExpected): void;
251-
toHaveSameSession(expected: undefined | Session): void;
252-
}
253-
interface Matchers<R> {
254-
toHaveSentReplay(expected?: SentReplayExpected): R;
255-
toHaveLastSentReplay(expected?: SentReplayExpected): R;
256-
toHaveSameSession(expected: undefined | Session): R;
257-
}
258-
}
246+
interface CustomMatchers<R = unknown> {
247+
toHaveSentReplay(expected?: SentReplayExpected): R;
248+
toHaveLastSentReplay(expected?: SentReplayExpected): R;
249+
toHaveSameSession(expected: undefined | Session): R;
250+
}
251+
252+
declare module 'vitest' {
253+
type Assertion<T = any> = CustomMatchers<T>;
254+
type AsymmetricMatchersContaining = CustomMatchers;
259255
}

packages/replay-internal/test/integration/errorSampleRate.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ describe('Integration | errorSampleRate', () => {
640640

641641
it('has correct timestamps when error occurs much later than initial pageload/checkout', async () => {
642642
const ELAPSED = BUFFER_CHECKOUT_TIME;
643-
const TICK = 20;
644643
const TEST_EVENT = getTestEventIncremental({ timestamp: BASE_TIMESTAMP });
645644
mockRecord._emitter(TEST_EVENT);
646645

packages/replay-internal/test/integration/flush.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { vi } from 'vitest';
2-
import type { MockedFunction, MockInstance } from 'vitest';
2+
import type { MockedFunction } from 'vitest';
33

44
import * as SentryBrowserUtils from '@sentry-internal/browser-utils';
55
import * as SentryUtils from '@sentry/utils';
@@ -8,7 +8,6 @@ import { DEFAULT_FLUSH_MIN_DELAY, MAX_REPLAY_DURATION, WINDOW } from '../../src/
88
import type { ReplayContainer } from '../../src/replay';
99
import { clearSession } from '../../src/session/clearSession';
1010
import type { EventBuffer } from '../../src/types';
11-
import * as AddMemoryEntry from '../../src/util/addMemoryEntry';
1211
import { createPerformanceEntries } from '../../src/util/createPerformanceEntries';
1312
import { createPerformanceSpans } from '../../src/util/createPerformanceSpans';
1413
import * as SendReplay from '../../src/util/sendReplay';
@@ -21,7 +20,6 @@ useFakeTimers();
2120

2221
type MockSendReplay = MockedFunction<any>;
2322
type MockAddPerformanceEntries = MockedFunction<ReplayContainer['_addPerformanceEntries']>;
24-
type MockAddMemoryEntry = MockInstance;
2523
type MockEventBufferFinish = MockedFunction<EventBuffer['finish']>;
2624
type MockFlush = MockedFunction<ReplayContainer['_flush']>;
2725
type MockRunFlush = MockedFunction<ReplayContainer['_runFlush']>;
@@ -39,7 +37,6 @@ describe('Integration | flush', () => {
3937
let mockFlush: MockFlush;
4038
let mockRunFlush: MockRunFlush;
4139
let mockEventBufferFinish: MockEventBufferFinish;
42-
let mockAddMemoryEntry: MockAddMemoryEntry;
4340
let mockAddPerformanceEntries: MockAddPerformanceEntries;
4441

4542
beforeAll(async () => {
@@ -68,8 +65,6 @@ describe('Integration | flush', () => {
6865
mockAddPerformanceEntries.mockImplementation(async () => {
6966
return [];
7067
});
71-
72-
mockAddMemoryEntry = vi.spyOn(AddMemoryEntry, 'addMemoryEntry');
7368
});
7469

7570
beforeEach(async () => {

packages/replay-internal/test/utils/TestClient.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ export class TestClient extends BaseClient<TestClientOptions> {
2020
exception: {
2121
values: [
2222
{
23-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2423
type: exception.name,
2524
value: exception.message,
26-
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
2725
},
2826
],
2927
},

packages/replay-internal/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"compilerOptions": {
44
"module": "esnext"
55
},
6-
"include": ["src/**/*.ts"]
6+
"include": ["src/**/*.ts", "./test.setup.ts", "./vitest.config.ts"]
77
}

0 commit comments

Comments
 (0)