(message: string, printElementTree: boolean)
| 83 | } |
| 84 | |
| 85 | function formatErrorMessage(message: string, printElementTree: boolean) { |
| 86 | if (!printElementTree) { |
| 87 | return message; |
| 88 | } |
| 89 | |
| 90 | if (screen.isDetached) { |
| 91 | return `${message}\n\nScreen is no longer attached. Check your test for "findBy*" or "waitFor" calls that have not been awaited.\n\nWe recommend enabling "eslint-plugin-testing-library" to catch these issues at build time:\nhttps://oss.callstack.com/react-native-testing-library/docs/start/quick-start#eslint-plugin`; |
| 92 | } |
| 93 | |
| 94 | const json = screen.toJSON(); |
| 95 | if (!json) { |
| 96 | return message; |
| 97 | } |
| 98 | |
| 99 | return `${message}\n\n${formatJson(json)}`; |
| 100 | } |
| 101 | |
| 102 | function appendElementTreeToError(error: Error) { |
| 103 | const oldMessage = error.message; |
no test coverage detected
searching dependent graphs…