How can I test a server component.
Unanswered
Seppala Siberian Sleddog posted this in #help-forum
Seppala Siberian SleddogOP
I have a home page for example and I want to check if it loads properly but it's a server component how I can accomplish that?
23 Replies
Seppala Siberian SleddogOP
I want automated tests
ahh, should've specified that
@Seppala Siberian Sleddog is your issue resolved?
Seppala Siberian SleddogOP
Not really Cyprus does not work with NextJs 14
@Seppala Siberian Sleddog Not really Cyprus does not work with NextJs 14
playwright seems to be the only good one
and cypress e2e
@Seppala Siberian Sleddog Not really Cyprus does not work with NextJs 14
You mean Cyprus or jest?
i'll just put this here
Good to know: Since async Server Components are new to the React ecosystem, Jest currently does not support them. While you can still run unit tests for synchronous Server and Client Components, we recommend using an E2E tests for async components.
Good to know: Since async Server Components are new to the React ecosystem, Jest currently does not support them. While you can still run unit tests for synchronous Server and Client Components, we recommend using an E2E tests for async components.
@joulev i'll just put this here
Good to know: Since async Server Components are new to the React ecosystem, Jest currently does not support them. While you can still run unit tests for synchronous Server and Client Components, **we recommend using an E2E tests for async components**.
Seppala Siberian SleddogOP
Yes in then E2E section they provide Cypress library for testing the server components but, in that page they mention it's not supported in version 14 it should be 13
@Anay-208 You mean Cyprus or jest?
Seppala Siberian SleddogOP
Cypress for testing the server components, jest does not support it, and Cypress it supports only NextJS 13 and older versions so it will not work with NextJS 14.
@!=tgt playwright seems to be the only good one
Seppala Siberian SleddogOP
Does it work with NextJS 14?
Seppala Siberian SleddogOP
Yeah sorry đ
@joulev i'll just put this here
Good to know: Since async Server Components are new to the React ecosystem, Jest currently does not support them. While you can still run unit tests for synchronous Server and Client Components, **we recommend using an E2E tests for async components**.
Yes⌠so there is that. They donât recommend running component tests for async components. Just make E2E tests, which Cypress supports very well
Server components are still very new, few if any testing tools have released support for it
@joulev Yes⌠so there is that. They donât recommend running component tests for async components. Just make E2E tests, which Cypress supports very well
Seppala Siberian SleddogOP
The problem with Cypress that it does not support version 14, I'm trying playwright to achieve it
@Seppala Siberian Sleddog The problem with Cypress that it does not support version 14, I'm trying playwright to achieve it
Cypress supports E2E testing for v14 as well. Playwright is a good option too, though I also doubt it supports component testing for server components.
Just write E2E tests.
Just write E2E tests.
playwright's just e2e testing
@joulev Cypress supports E2E testing for v14 as well. Playwright is a good option too, though I also doubt it supports component testing for server components.
Just write E2E tests.
Seppala Siberian SleddogOP
Warning:
For component testing, Cypress currently does not support Next.js version 14 and async Server Components. These issues are being tracked. For now, component testing works with Next.js version 13, and we recommend E2E testing for async Server Components.
Cypress currently does not support TypeScript version 5 with moduleResolution:"bundler". This issue is being tracked.
For component testing, Cypress currently does not support Next.js version 14 and async Server Components. These issues are being tracked. For now, component testing works with Next.js version 13, and we recommend E2E testing for async Server Components.
Cypress currently does not support TypeScript version 5 with moduleResolution:"bundler". This issue is being tracked.
@Seppala Siberian Sleddog Warning:
For component testing, Cypress currently does not support Next.js version 14 and async Server Components. These issues are being tracked. For now, component testing works with Next.js version 13, and we recommend E2E testing for async Server Components.
Cypress currently does not support TypeScript version 5 with moduleResolution:"bundler". This issue is being tracked.
Yes and read my message again. I never told you to do component testing. I told you to do end-to-end testing. Where nextjs 14 works very well. You can even test random websites on the internet, not just nextjs 14 websites.
@joulev Yes and read my message again. I never told you to do component testing. I told you to do end-to-end testing. Where nextjs 14 works very well. You can even test random websites on the internet, not just nextjs 14 websites.
Seppala Siberian SleddogOP
okay, thanks I'll look into it,