fix: prefer globalThis over global in Jest setup (Sonar S7764)#3070
fix: prefer globalThis over global in Jest setup (Sonar S7764)#3070arkid15r merged 6 commits intoOWASP:mainfrom
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughRemoved conditional structuredClone polyfill assignment from frontend/jest.setup.ts that relied on the global object. The polyfill block is deleted, with structuredClone handling delegated to other imports. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This PR addresses SonarCloud rule typescript:S7764 and ensures environment-agnostic behavior using |
|
arkid15r
left a comment
There was a problem hiding this comment.
I removed the redundant fallback polyfill. The file already imports core-js/actual/structured-clone at the top, which provides a proper structuredClone polyfill, so the JSON.parse(JSON.stringify(...)) fallback was unnecessary and triggered the SonarQube rule.
…#3070) * refactor: remove redundant exception handling reported by SonarCloud * fix: prefer globalThis over global in Jest setup (Sonar S7764) * chore: suppress intentional structuredClone polyfill fallback (NOSONAR) * chore: suppress Sonar warning for intentional structuredClone polyfill * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>





Proposed change
Replaced usage of
globalwithglobalThisinfrontend/jest.setup.tsto comply with SonarCloud rule typescript:S7764. This ensures consistent
behavior across environments (Node.js, browser, workers) and improves
maintainability.
Resolves #3069
Checklist