-
Notifications
You must be signed in to change notification settings - Fork 85
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
chore: unit test cases for error reporting plugin #1813
Conversation
WalkthroughWalkthroughThe recent changes enhance the error reporting functionality within the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ErrorReportingPlugin
participant MetricsService
Client->>ErrorReportingPlugin: Initialize with sourceConfig
alt Valid Initialization
ErrorReportingPlugin->>MetricsService: Report error (if conditions met)
else Invalid Initialization
ErrorReportingPlugin->>Client: Do not report error
end
Client->>ErrorReportingPlugin: Trigger error notification
alt httpClient not provided
ErrorReportingPlugin-->>MetricsService: Report error
else httpClient provided
alt Specific error message
ErrorReportingPlugin-->>Client: No report sent
else Other conditions
ErrorReportingPlugin-->>MetricsService: Report error
end
end
Client->>ErrorReportingPlugin: Create breadcrumb
ErrorReportingPlugin->>MetricsService: Handle breadcrumb
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/analytics-js-plugins/tests/errorReporting/index.test.ts (2 hunks)
Additional comments not posted (9)
packages/analytics-js-plugins/__tests__/errorReporting/index.test.ts (9)
58-61
: LGTM!The test case correctly verifies that the error reporting provider plugin is not invoked during initialization if the request is from the latest core SDK.
63-72
: LGTM!The test case correctly verifies that the error reporting provider plugin is not invoked during initialization if
sourceConfig
lacks required parameters.
74-83
: LGTM!The test case correctly verifies that the error reporting provider plugin is invoked during initialization if the request is from an old core SDK and ensures the
invokeSingle
method is called with the correct arguments.
85-101
: LGTM!The test case correctly verifies that the error reporting provider plugin is invoked during notification if
httpClient
is not provided and ensures theinvokeSingle
method is called with the correct arguments.
104-137
: LGTM!The test case correctly verifies that data is not sent to the metrics service if the error message contains specific content and ensures the
getAsyncData
method is not called.
Line range hint
139-157
:
LGTM!The test case correctly verifies that data is sent to the metrics service during notification if
httpClient
is provided and ensures thegetAsyncData
method is called.
Line range hint
159-173
:
LGTM!The test case correctly verifies that the error reporting provider plugin does not notify if the error is not an SDK error and ensures the
getAsyncData
method is not called.
Line range hint
175-209
:
LGTM!The test case correctly verifies that a new breadcrumb is added and ensures the
invokeSingle
method is not called.
211-225
: LGTM!The test case correctly verifies that the error reporting provider plugin is invoked on new breadcrumb if state is not provided and ensures the
invokeSingle
method is called with the correct arguments.
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1813 +/- ##
===========================================
+ Coverage 56.63% 56.67% +0.04%
===========================================
Files 473 473
Lines 16108 16108
Branches 3228 3216 -12
===========================================
+ Hits 9122 9129 +7
- Misses 5737 5745 +8
+ Partials 1249 1234 -15 ☔ View full report in Codecov by Sentry. |
size-limit report 📦
|
PR Description
Linear task (optional)
Linear task link
Cross Browser Tests
Please confirm you have tested for the following browsers:
Sanity Suite
Security
Summary by CodeRabbit