bugsnag / bugsnag-js-performance

Monitor the performance of your JavaScript (web and React Native) and see the results in your BugSnag dashboard.
https://docs.bugsnag.com/performance/integration-guides
MIT License
5 stars 3 forks source link

Fix URL.hostname error on React Native #504

Closed yousif-bugsnag closed 1 month ago

yousif-bugsnag commented 1 month ago

Goal

Avoid using URL.hostname to add the API key subdomain to the default endpoint.

URL properties such as hostname are not implemented in React Native and throw an error when accessed.

Design

Replaced URL usage with a simple string replace to insert the API key - because the code only gets executed for the default endpoint the value is essentially hardcoded, and we have unit tests that would fail if the endpoint ever changed.

Testing

This cannot be e2e tested as the e2e tests use a custom endpoint, so relied on existing unit tests and tested manually in a React Native app.

github-actions[bot] commented 1 month ago

Browser bundle size

NPM build

Package
Before 196.14 kB
After 195.96 kB
± -175 bytes 🎉

CDN build

Unminified Minfied Minified + gzipped
Before 98.89 kB 36.61 kB 11.07 kB
After 98.71 kB 36.58 kB 11.07 kB
± -175 bytes 🎉 -27 bytes 🎉 +3 bytes ⚠️

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/core.ts 100%
(+0%)
93.75%
(+0%)
92.85%
(+0%)
98.46%
(-0.04%)

Total:

Lines Branches Functions Statements
87.81%(-0.02%) 78.92%(+0%) 88.79%(+0%) 85.9%(-0.01%)

Generated against 8e7fafa6020c3c788648569b831e78df4eaca9e6 on 11 September 2024 at 08:51:09 UTC