Skip to content

Instantly share code, notes, and snippets.

@nickmccurdy
Last active May 16, 2023 03:05
Show Gist options
  • Save nickmccurdy/a5797bec9bb7e1156f814846c9bcb04b to your computer and use it in GitHub Desktop.
Save nickmccurdy/a5797bec9bb7e1156f814846c9bcb04b to your computer and use it in GitHub Desktop.
rsc-testing test report
~/Repos/rsc-testing → env CI=true npm test -- -t "client component"
> my-app@0.1.0 test
> vitest -t client component
RUN v0.31.0 /Users/nick/Repos/rsc-testing
stderr | app/test.tsx > client component
Warning: A suspended resource finished loading inside a test, but the event was not wrapped in act(...).
When testing, code that resolves suspended data should be wrapped into act(...):
act(() => {
/* finish loading suspended data */
});
/* assert on the output */
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
Error: This root received an early update, before anything was able hydrate. Switched the entire root to client rendering.
at updateHostRoot (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:15478:58)
at beginWork$1 (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:17346:14)
at beginWork (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:25662:14)
at performUnitOfWork (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:24516:12)
at workLoopSync (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:24229:5)
at renderRootSync (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:24194:7)
at performSyncWorkOnRoot (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:23689:20)
at flushSyncWorkAcrossRoots_impl (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:9966:13)
at flushSyncWorkOnAllRoots (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:9924:3)
at flushSync$1 (/Users/nick/Repos/rsc-testing/node_modules/react-dom/cjs/react-dom.development.js:23801:7)
❯ app/test.tsx (3 tests | 1 failed | 2 skipped) 73ms
❯ app/test.tsx > client component
→ Unable to find an element with the text: client. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body />
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL app/test.tsx > client component
TestingLibraryElementError: Unable to find an element with the text: client. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body />
❯ Object.getElementError node_modules/@testing-library/dom/dist/config.js:37:19
❯ node_modules/@testing-library/dom/dist/query-helpers.js:76:38
❯ node_modules/@testing-library/dom/dist/query-helpers.js:52:17
❯ getByText node_modules/@testing-library/dom/dist/query-helpers.js:95:19
❯ app/test.tsx:9:17
7|
8| test.each(['client', 'server', 'layout'])(`%s component`, (keyword) => {
9| expect(screen.getByText(keyword)).toBeInTheDocument()
| ^
10| })
11|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests 1 failed | 2 skipped (3)
Start at 22:40:51
Duration 1.85s (transform 89ms, setup 253ms, collect 215ms, tests 73ms, environment 513ms, prepare 120ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment