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

[Feature] Allow disabling console log output #355

Closed
IanVS opened this issue Sep 15, 2023 · 2 comments
Closed

[Feature] Allow disabling console log output #355

IanVS opened this issue Sep 15, 2023 · 2 comments
Labels
feature request New feature or request

Comments

@IanVS
Copy link
Member

IanVS commented Sep 15, 2023

Describe the Feature

After #157, we get nice output of console logs, but I'm finding that sometimes the entire dom dump from testing-library is repeated twice, which makes it really hard to find the names of the actual tests that are failing.

I'd like to propose an option that disables printing of console logs, or at least find a way to avoid showing the same text that is in the error message. The error message itself is helpfully truncated, but the browser logs are not, so this can be a very long dump indeed:

For example, this is the kind of output I would like to avoid:

  warn: You are using Testing Library's `screen` object. Use `within(canvasElement)` instead.
    More info: https://storybook.js.org/docs/react/essentials/interactions

    error: TestingLibraryElementError: Unable to find an accessible element with the role "dialog" and name "Add authenticator"

    There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole

    Ignored nodes: comments, script, style
    <body
      class="sb-show-main sb-main-padded"
      style=""
    >
      
      
      <div
        class="sb-preparing-story sb-wrapper"
      >
        
      
        <div
          class="sb-loader"
        />
        

      </div>
      


      <div
        class="sb-preparing-docs sb-wrapper"
      >
@IanVS IanVS added bug Something isn't working needs triage labels Sep 15, 2023
@yannbf yannbf added feature request New feature or request and removed needs triage bug Something isn't working labels Nov 27, 2023
@yannbf
Copy link
Member

yannbf commented Nov 27, 2023

Hey there! I recently merged #405 which does not disable the logs, but it does remove the duplicated error message. Thought I'd let you know, I think this will make your experience much better!

@IanVS
Copy link
Member Author

IanVS commented Nov 27, 2023

Seems like a good fix, thanks.

@IanVS IanVS closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants