react-testing-library: some portion of debug's output is not visible react-testing-library: some portion of debug's output is not visible reactjs reactjs

react-testing-library: some portion of debug's output is not visible


You need to change the value of DEBUG_PRINT_LIMIT env variable (default is 7000).

For example, run your tests with: DEBUG_PRINT_LIMIT=10000 yarn test

Source: https://github.com/testing-library/dom-testing-library/blob/master/src/pretty-dom.js#L24


I am using this version: "@testing-library/react": "^11.0.4"

able to do just like below, we can change 300000 as the max length of output.

debug(undefined, 300000)  


The second argument of the debug() function can be used to set maxLengthToPrint.

E.g. to print everything in myElement using the recommended screen approach:

import {render, screen} from '@testing-library/react'render(<MyComponent />);const myElement = await screen.findByText(/someText/i);const maxLengthToPrint = 100000screen.debug(myElement, maxLengthToPrint);

See: