NextJS testing with Vitest and React Testing Library || web boss

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024

ความคิดเห็น • 8

  • @HayetFellah
    @HayetFellah 5 หลายเดือนก่อน

    Hi, would you happen to know how to mock next/dynamic and test components which dynamically import other components ? Great video btw :D

  • @end2399
    @end2399 4 หลายเดือนก่อน

    Great video!

    • @webboss
      @webboss  หลายเดือนก่อน

      Thanks!

  • @0xtz_
    @0xtz_ หลายเดือนก่อน

    i have trpc and wen i run the test I'm getting :
    > Render Documents Module
    TRPCClientError: `cookies` was called outside a request scope.

    • @webboss
      @webboss  หลายเดือนก่อน +1

      Hi, you will need a mechanism for intercepting your trpc requests and stubbing your responses. I use mock service worker for REST APIs but not quite sure if it supports trpc.

    • @0xtz_
      @0xtz_ หลายเดือนก่อน

      @@webboss hmmm 🤔
      thanks man I ll check
      I think bc I have auth not sure but lemme keep checking Google

  • @jervx829
    @jervx829 4 หลายเดือนก่อน

    Hi I'm new to testing, since Nextjs contains both front-end and back end, how can we test both?
    If I set the environment to jsdom some of my tests in api/ doesn't work as they require some node/serverside lib/functionality
    but when I change the environment to node the front end test fails.