Skip to content

feat: event debugging (WIP) - #1726

Open
mdjastrzebski wants to merge 1 commit into
mainfrom
feat/event-debugging
Open

feat: event debugging (WIP)#1726
mdjastrzebski wants to merge 1 commit into
mainfrom
feat/event-debugging

Conversation

@mdjastrzebski

@mdjastrzebskimdjastrzebski commented Jan 7, 2025

Copy link
Copy Markdown
Member

Summary

Resolves#1717
Resolves#1718

Introduces (event) debugging mode that outputs information about event handles not being called due to disabled state, etc.

Details

Enabling: configure({ debug: true }). Cannot be configured on render as fireEvent and userEvent are independent modules, not returns from render.

Fire Event:

  • logs warnings when event handler was found but disabled:
  • logs warning when no event handler was invoked for given fireEvent call.

User Event:

  • logs debug for events that have missing event handlers.

To Do

  • User Event: log warning if no event at all has been called for given userEvent call.
  • Fire Event & User Event: consider logging debug for matches/called event handlers.

Test plan

@codecov

codecovBot commented Jan 7, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 86.17886% with 17 lines in your changes missing coverage. Please review.

Project coverage is 95.47%. Comparing base (17ccd9e) to head (95845da).

Files with missing linesPatch %Lines
src/helpers/logger.ts59.25%11 Missing ⚠️
src/fire-event.ts86.36%6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1726 +/- ##
==========================================
- Coverage 95.50% 95.47% -0.04% 
==========================================
Files 92 92 Lines 5139 5235 +96 Branches 563 901 +338 ==========================================
+ Hits 4908 4998 +90 - Misses 231 237 +6 

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

@mdjastrzebski

Copy link
Copy Markdown
MemberAuthor

Could you share your feedback on this potential new feature @pierrezimmermannbam@MattAgn@AugustinLF

Comment threadsrc/config.ts
concurrentRoot: boolean;

/**
* Verbose logging for the library.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i would add what it helps log : user event and fire event issues (for now)

Comment threadsrc/config.ts
asyncUtilTimeout: 1000,
defaultIncludeHiddenElements: false,
concurrentRoot: true,
debug: false,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

imo true is a good default because otherwise i fear not many people will hear about it and remember to turn it on
do you see more advantages with false as default ?

@MattAgn

Copy link
Copy Markdown
Collaborator

This is gonna be so helpful to debug! ✅

Sign up for freeto 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.

UX: feedback when event could not be triggered due to disabled state, etc Log when fireEvent fails to fire an event

2 participants

@mdjastrzebski@MattAgn