Skip to content

feat(replay): Add toHaveLastSentReplay jest matcher #6467

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

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Dec 7, 2022

Really we renamed the previous toHaveSentReplay -> toHaveLastSentReplay and added toHaveSentReplay to match all calls to transport.

Really we renamed the previous `toHaveSentReplay` -> `toHaveLastSentReplay` and added `toHaveSentReplay` to match all calls to transport.
@billyvg billyvg requested review from mydea and Lms24 December 7, 2022 21:50
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.67 KB (-0.02% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.94 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.46 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 54.49 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.26 KB (0%)
@sentry/browser - Webpack (minified) 66.24 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.29 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.28 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.66 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.11 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 41.79 KB (-0.01% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.91 KB (0%)

@billyvg billyvg marked this pull request as ready for review December 8, 2022 14:41
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mydea and I discussed custom Jest matchers with the rest our team, as we're not using them anywhere except for the Replay package. The general consense is that we'd like to continue it that way and if possible not add new matchers. In the long run, it'd be great to relace them in Replay as well for consistency.

Given however, that the Replay matchers are quite complex (at least to me), I wonder if it is reasonable to even convert them to e.g. helper functions we'd call in the respective tests. I'm not saying we can't merge this in but I'd be curious about your general opinion here. WDYT, is it reasonable to stop using matchers or do you want to continue using them?

expectedVal: SentReplayExpected[keyof SentReplayExpected];
actualVal: SentReplayExpected[keyof SentReplayExpected];
};
type Call = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm wondering if "Call" is a good name here. Isn't this just an Envelope?

@billyvg
Copy link
Member Author

billyvg commented Dec 9, 2022

It's certainly possible to move the assertion logic to a helper function, but we'd lose out on some formatting when tests fail. Another possibility is to snapshot the call args.

@billyvg billyvg merged commit aafa7cb into master Dec 12, 2022
@billyvg billyvg deleted the feat-replay-add-toHaveLastSentReplay branch December 12, 2022 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants