Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(replay): Split replay integration & container class #6407

Merged
merged 3 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/replay/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,14 @@ Unless you manually imported this and used it somewhere in your codebase, this w

The `Session` object exported from Replay is now a plain object, instead of a class.
This should not affect you unless you specifically accessed this class & did custom things with it.

## Reduce public API of Replay integration (https://github.com/getsentry/sentry-javascript/pull/6407)

The result of `new Replay()` now has a much more limited public API. Only the following methods are exposed:

```js
const replay = new Replay();

replay.start();
replay.stop();
```
6 changes: 3 additions & 3 deletions packages/replay/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { getCurrentHub } from '@sentry/core';
import { Transport } from '@sentry/types';

import { Replay } from './src';
import { ReplayContainer } from './src/replay';
import { Session } from './src/session/Session';

// @ts-ignore TS error, this is replaced in prod builds bc of rollup
Expand Down Expand Up @@ -54,7 +54,7 @@ type SentReplayExpected = {
};

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const toHaveSameSession = function (received: jest.Mocked<Replay>, expected: undefined | Session) {
const toHaveSameSession = function (received: jest.Mocked<ReplayContainer>, expected: undefined | Session) {
const pass = this.equals(received.session?.id, expected?.id) as boolean;

const options = {
Expand All @@ -77,7 +77,7 @@ const toHaveSameSession = function (received: jest.Mocked<Replay>, expected: und
*/
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const toHaveSentReplay = function (
_received: jest.Mocked<Replay>,
_received: jest.Mocked<ReplayContainer>,
expected?: SentReplayExpected | { sample: SentReplayExpected; inverse: boolean },
) {
const { calls } = (getCurrentHub().getClient()?.getTransport()?.send as MockTransport).mock;
Expand Down
Loading