1

When using vitest to test a UI, I'm trying to do a screen.getBy.. that fails.

When it fails, I see the rendered HTML as a log, but it cuts off abruptly so that I can't see the elements that actually interest me. I've tried adding the env var DEBUG_PRINT_LIMIT=1000000 - didnt work. Tried doing a screen.debug(..) - also didn't work .

Any idea how I can view the full log? Also on that same note, is there any way that I can view the current state of the page I'm rendering in a browser.. ?

1

1 Answer 1

-1

Try using one of these.

import { screen } from '@testing-library/react';

screen.debug(undefined, Infinity);
import { prettyDOM } from '@testing-library/react';

console.log(prettyDOM());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.