React Testing Crash Course with Next.js

Поделиться
HTML-код
  • Опубликовано: 9 сен 2024

Комментарии • 72

  • @kainorling7418
    @kainorling7418 Год назад +2

    finally you are back after 7 months we are glad that you are with us)

  • @noormuhammad888
    @noormuhammad888 Год назад

    Amazing crash course. Started by knowing nothing about testing react apps and finished with confidence. I'm able to follow along with you using the Typescript. Thank you man.

  • @Anthony-wg7fn
    @Anthony-wg7fn Год назад +2

    Thanks for going through the setup and explaining this. Please make more projects with TDD and if you could please include Integration and E2E testing in the future.

  • @6little6fang6
    @6little6fang6 Год назад +1

    You are such a good teacher, I always find value in your videos.

    • @ansonthedev
      @ansonthedev  9 месяцев назад

      I'm late but thank you very much!

  • @user-hb2rt7ek8x
    @user-hb2rt7ek8x 9 месяцев назад +2

    cannot find module 'msw/node' from 'mocks/server.js', after the msw moved to v2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @user-np3iq6rm9w
    @user-np3iq6rm9w Год назад

    Thank you for the helpful video. I have to say that the most intricate part when using jest is setting up the testing environment and you definitely help me overcome it. I have to read more and more to understand how the chain of libraries work together to make jest operate with browser API, browser features and DOM tree. Once again, thanks so much and I hope you can release more informative videos.

  • @Doc131282
    @Doc131282 Год назад

    Welcome back, Anson. I was worried, that something bad happened. Thanks for another tutorial :)

  • @prashlovessamosa
    @prashlovessamosa Год назад +4

    Hey Anson long time
    your express playlist helps me alot I am very grateful to you Thank you

    • @ansonthedev
      @ansonthedev  Год назад

      You're welcome. Great to hear that! :)

  • @Doppio_00
    @Doppio_00 Год назад +3

    use App router nextjs13
    import {useRouter} from 'next/navigation';
    const router = useRouter();
    This is not testable when used
    Please help

    • @AstraSlade
      @AstraSlade Год назад +1

      Same here

    • @focusme-tv3650
      @focusme-tv3650 Год назад +1

      I have the same issue... Router is not mounted yet when trying to render a component. Please make a video about it 🥺

  • @clouds187
    @clouds187 Год назад

    Welcome back anson! Im certain everybody missed you! Can’t wait for your livestreams!

  • @ronitgandhi7716
    @ronitgandhi7716 Год назад +1

    Bro How you been?!! Welcome back, btw loved your livedstreams got to learn alot from the chuchat streams and really liked your keyboard cam streams...

  • @samane3672
    @samane3672 16 дней назад

    Very grateful for this

  • @user-bm7rc8dy6q
    @user-bm7rc8dy6q 10 месяцев назад

    If you get this error when running the test @13 mins...
    Cannot find module 'jest-dom/extend-expect'
    Change your import in jest setup file to this: import "@testing-library/jest-dom";

  • @user-sq3io6ny4c
    @user-sq3io6ny4c 9 месяцев назад

    Thanks for the video, it's really kind of you to share so much of your time! One note I have is that your VSCode colours aren't great for people with colour vision deficiency - I can barely see the red colours on your screen (e.g. brackets) which might not sound like a big deal but actually it can make it really difficult to grasp what you've written at times. Please consider switching to a palette that has better contrast throughout!

  • @gigantino
    @gigantino 11 месяцев назад

    Can't find you on Discord anymore, so I guess that sending you a private message isn't an option.
    But I watched your very first discord bots and dashboard series, and you pretty much kickstarted my carreer.
    I have been working professionaly for a year now as a self-taught software engineer, thank you.

  • @bideshbanerjee5506
    @bideshbanerjee5506 Год назад

    Finally you are back....your redux video was awesome

  • @grmn3564
    @grmn3564 10 месяцев назад

    I had this error:
    "Cannot find module '@testing-library/jest-dom/extend-expect' from 'jest.setup.js'"
    I fixed it by removing the 'extend-expect' part.

  • @trut52
    @trut52 Год назад

    great video! even as an experienced programmer I learned something

  • @emanoelinfinity
    @emanoelinfinity 11 месяцев назад

    In the case of configuration using Typescript, we currently have to install Jest types as well.

  • @natalianatalia3677
    @natalianatalia3677 Год назад

    Hi! Im looking for Jest tutorial for nextjs with app directory. Does anyone know anything about it?

  • @vaibhavkumar8140
    @vaibhavkumar8140 Год назад

    Hey Anson welcome back, i hope you are good ❤😊

  • @user-dn7yl7ms1u
    @user-dn7yl7ms1u 9 месяцев назад

    at 40:33 if you are searching for role in Chrome/Chromium you can find it under Accessibility and not Computed Styles (at least on my end)

  • @user-bm7rc8dy6q
    @user-bm7rc8dy6q 10 месяцев назад

    Love that you did a TS setup. Will you be providing a TDD project with react + ts in the future? The react tdd with ts topic has a shortage of good learning materials.

  • @prashlovessamosa
    @prashlovessamosa Год назад

    Hey Anson can you please make next 13.4 lecture it would be super helpful.
    Happy Teachers day.

  • @hamzahahmad1670
    @hamzahahmad1670 Год назад

    Underrated channel

  • @user-km3gi8qu4g
    @user-km3gi8qu4g Год назад

    Welcome back miss your videos a lot🎉🎉🎉

  • @Alireza-kw6fj
    @Alireza-kw6fj Год назад

    Should I see this video if i want testing in nextjs app router

  • @SO-xs6wu
    @SO-xs6wu Год назад +2

    Welcome Back 😁

  • @user-bm7rc8dy6q
    @user-bm7rc8dy6q 10 месяцев назад

    Isn't looking for specific text in the dom the same as testing implementation? The text could easily change and this makes the tests more brittle.

    • @ansonthedev
      @ansonthedev  10 месяцев назад

      Of course the context matters here, if you're looking for a specific text in the DOM as a result of a behavior, then no it is not. The text value in the DOM can be the result of an async operation that happened, e.g: making an API call. Of course if you were testing if the API call was made, instead of focusing on testing the result of what happens after the API call, then that would be testing the implementation.

    • @user-bm7rc8dy6q
      @user-bm7rc8dy6q 9 месяцев назад

      Interesting. What if you are testing the expected text from an api call but the returned response from the api call varies per call even with the same payload i.e. Getting appointment data from a store or products from a cms that someone else updates? At that point, checking text from api's in your test would fail of someone updates the content coming from the cms etc... no?@@ansonthedev

    • @ansonthedev
      @ansonthedev  9 месяцев назад

      No, because you aren't actually running those tests while your API is being called in a production environment. You're thinking that if someone is actively using the app, it is going to cause the test to fail. Well tests don't run in the live production app. They run when you run them locally, when you run them on a Pipeline, before deployments, etc. everything BUT when the live app is running.
      In your example, you would actually:
      1) Call an API with a Payload, assert a behavior on the DOM occurred after the API call was made.
      2) Call the API again and change the data with something else, assert the expected behavior occurred.
      So each time you are making a change to the API in your test, you are asserting that the output of that change happened on the page. When people use your app live, you are not re-running your tests again.
      Tests are designed to run isolated away from the actual software. Not while the software is running.

  • @alirezasoheili1701
    @alirezasoheili1701 Год назад

    This is awesome thanks a lot

  • @anupamchakrawarti1803
    @anupamchakrawarti1803 Год назад

    Found you on r/react. Great tutorial. Could you please make part 2 with mockImplementation. So, the usage of this is with redux/redux toolkit dispatch events.
    In my current project, I am using Electron with React, since E2E framework like Cypress doesn't provide support, its hard to test my code. Also, the fact that IPC events are tricky to test. Would love a tutorial touching these domains as well.
    Again, welcome back, what I could infer from fellow devs comments. :D

  • @9abour
    @9abour Год назад

    Great job... Thanks.

  • @legends_assemble4938
    @legends_assemble4938 7 месяцев назад

    Thanks!

  • @samiulsk3651
    @samiulsk3651 Год назад

    The bangle bazz

  • @jorgealmonacid3131
    @jorgealmonacid3131 Год назад

    Just thank you ❤

  • @cyanide2426
    @cyanide2426 Год назад

    Yay, you're back!

  • @ehnryoo1482
    @ehnryoo1482 Год назад

    yoo, anson welcome back👍

  • @gabrielmnzs
    @gabrielmnzs Год назад

    Nice video!
    I have a question about next/image. How can I mock and test a component that has images inside?

    • @noormuhammad888
      @noormuhammad888 Год назад

      next/image are basically image elements in DOM. you can get it just like any other HTML element.

  • @darthvader7683
    @darthvader7683 Год назад

    wonderful content

  • @lifeisbeautifu1
    @lifeisbeautifu1 Год назад

    Thank you!

  • @developer_01
    @developer_01 Год назад

    Welcome back, bro... Learn a lot from your project livestream.

    • @ansonthedev
      @ansonthedev  Год назад +1

      Thank you! I'm happy to hear. :)

  • @senne4179
    @senne4179 Год назад

    what keyboard you use or switches?

  • @hofimastah
    @hofimastah Год назад

    Hi Man. I cannot join discord

  • @ciach0_
    @ciach0_ Год назад

    You're back! What happened to your Discord account?

  • @icicles0
    @icicles0 Год назад

    Nice

  • @myothuko6380
    @myothuko6380 Год назад

    Welcome Back Anson

  • @hasina8570
    @hasina8570 Год назад

    ❤•••

  • @cake6103
    @cake6103 Год назад

    gg

  • @oscarortiz5794
    @oscarortiz5794 Год назад

    i miss your streams what happened!

    • @ansonthedev
      @ansonthedev  Год назад

      I'll be back soon :)

    • @oscarortiz5794
      @oscarortiz5794 Год назад

      @@ansonthedev thankgod, you were the only one that kept me coding since we used similar technologies, havent coded since lol

  • @rudzkygen
    @rudzkygen Год назад

    I had a problem while configuring jest with typescript - .toBeInTheDocument() was not found. Here's quick fix: pnpm add -D @types/testing-library__jest-dom

    • @user-hd5it1bk7c
      @user-hd5it1bk7c Год назад +2

      me too, it seems like there is no extend-expect in @testing-library/jest-dom

    • @noormuhammad888
      @noormuhammad888 Год назад

      @@user-hd5it1bk7c @rudzkygen replace your jest.setup,js with the following and it should work
      import "@testing-library/jest-dom";