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

🐛 Use EventTarget.prototype.addEventListener instead of the method #3137

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

amortemousque
Copy link
Contributor

@amortemousque amortemousque commented Nov 15, 2024

Motivation

Use the window.EventTarget.prototype when possible to avoid wrong overrides (e.g: salesforce/lwc#1824)

Changes

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque marked this pull request as ready for review November 15, 2024 10:49
@amortemousque amortemousque requested a review from a team as a code owner November 15, 2024 10:49
@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.26%. Comparing base (406bdd1) to head (c362ac2).

Files with missing lines Patch % Lines
packages/core/test/emulate/mockEventTarget.ts 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3137      +/-   ##
==========================================
- Coverage   93.69%   93.26%   -0.44%     
==========================================
  Files         279      280       +1     
  Lines        7680     7673       -7     
  Branches     1717     1718       +1     
==========================================
- Hits         7196     7156      -40     
- Misses        484      517      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

const addEventListenerSpy = jasmine.createSpy()
const removeEventListenerSpy = jasmine.createSpy()

// The stopLeakDetection function of the global after each hook will reset the EventTarget.prototype.addEventListener
Copy link
Contributor Author

@amortemousque amortemousque Nov 15, 2024

Choose a reason for hiding this comment

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

The addEventListener override conflicts with the leakDetection. The best way I found is to let the stopLeakDetection remove the override

Copy link

cit-pr-commenter bot commented Nov 15, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 161.46 KiB 161.54 KiB 78 B +0.05%
Logs 55.77 KiB 55.85 KiB 78 B +0.14%
Rum Slim 110.30 KiB 110.38 KiB 78 B +0.07%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.001 -0.000
addaction 0.047 0.036 -0.011
addtiming 0.001 0.001 -0.001
adderror 0.046 0.030 -0.016
startstopsessionreplayrecording 1.227 0.808 -0.419
startview 1.382 0.991 -0.392
logmessage 0.020 0.019 -0.002
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 7.99 KiB 8.68 KiB 713 B
addaction 39.24 KiB 41.82 KiB 2.58 KiB
addtiming 6.83 KiB 7.70 KiB 897 B
adderror 45.18 KiB 47.37 KiB 2.18 KiB
startstopsessionreplayrecording 6.03 KiB 8.39 KiB 2.37 KiB
startview 424.56 KiB 426.10 KiB 1.53 KiB
logmessage 39.82 KiB 40.93 KiB 1.10 KiB

🔗 RealWorld

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.

2 participants