它不适用于React Native,而是使用jsdom和document。 - Greg Wozniak 哇,真棒✨。对于刚开始的人来说,请注意你还必须运行jest-preview服务器才能使其正常工作。 - undefined 8 由于DOM的大小可能非常大,您可以通过环境变量DEBUG_PRINT_LIMIT设置要打印的DOM内容限制。默认值为7000。当DOM内容被剥离(因为您设置的长...
( <Profile firstName="John" lastName="Doe" age={35} profileId="1234-fake-5678-uuid" /> ); test("renders app", () => { renderProfile(); // screen.debug is going to print the current DOM into the console screen.debug(); expect(screen.getByText(/John Doe/i)).toBeInTheDocument...
If it is, we call screen.debug() to print the current state of the DOM. Finally, we call the original console.error function to print the error message. This way, anytime a test fails with a TestingLibraryElementError, you will automatically get a snapshot of the DOM at the moment ...
print{.datatables-noprint{display:none;}}} at VirtualConsole.<anonymous> (.yarn/__virtual__/jsdom-virtual-f91bf4c0c4/0/cache/jsdom-npm-16.7.0-216c5c4bf9-454b833718.zip/node_modules/jsdom/lib/jsdom/virtual-console.js:29:45) at exports.createStylesheet (.yarn/__virtual__/jsdom-...
If it is, we call screen.debug() to print the current state of the DOM. Finally, we call the original console.error function to print the error message. This way, anytime a test fails with a TestingLibraryElementError, you will automatically get a snapshot of the DOM at the moment ...
If it is, we call screen.debug() to print the current state of the DOM. Finally, we call the original console.error function to print the error message. This way, anytime a test fails with a TestingLibraryElementError, you will automatically get a snapshot of the DOM at the moment ...