How to Debug Jest Tests in VS Code for React

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • In this video we learn how to debug jest tests in visual studio code for a react project. We also learn how to use the debugger in visual studio code.
    Introduction to Testing React Components
    • Introduction to Testin...
    The following topics are covered:
    Configure debugger in vs code,
    Debugging actions: step in, step out, step over
    VSCode Tools: watch variables and using the debug console.

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

  • @kirarevcrow
    @kirarevcrow 2 ปีที่แล้ว +3

    Among the few TH-camrs that actually take the time to explain the little things and don't assume things. Keep it up!

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +1

      Thank you Revcrow! I really appreciate the feedback! 😁

  • @kinneko3140
    @kinneko3140 27 วันที่ผ่านมา +2

    Very good explained. Good that somebody teach javascript developer the basics of programming. But it is not what I exactly search for. I want to start only one test and debug it. I use the "debug test" from visual studio code, it says that a debugger is attached, but i do not hit a breakpoint. maybe I expect too much from javascript :) I normally work with C# or Go, which is really easy to debug

    • @CodingWithAdam
      @CodingWithAdam  21 วันที่ผ่านมา +1

      Thank you! JavaScript/ node.js can be a bit difficult compared to languages like C#. I would suggest checking out some of the vs code extensions like jest test runner. They add a debug and run test button above each test. You can also open a debug terminal from vs code. I hope that you were able to figure this out. It might be a good future video idea that I might work on.

  • @sleepingUgly
    @sleepingUgly 2 ปีที่แล้ว +3

    this was wonderful Adam.. thank you

  • @TheSlyProfessor
    @TheSlyProfessor 2 ปีที่แล้ว +1

    This didn't work for me unfortunately. I wonder what config change I need to make...

    • @TheSlyProfessor
      @TheSlyProfessor 2 ปีที่แล้ว +1

      Never mind. It was an issue with path because my folder was part of a larger workspace. It's working now, but it is running all of the tests. Is there a way to select a specific path so to run only a subset of tests based on a directory I choose?

    • @CodingWithAdam
      @CodingWithAdam  2 ปีที่แล้ว +1

      Hi Nakul, this answer from stackover flow might help stackoverflow.com/a/61012334

  • @jonaskromwell4464
    @jonaskromwell4464 ปีที่แล้ว +1

    Would this also be possible in Visual Studio 2022?

    • @CodingWithAdam
      @CodingWithAdam  ปีที่แล้ว

      I’m not sure but my guess is that it is different.

    • @jonaskromwell4464
      @jonaskromwell4464 ปีที่แล้ว +1

      @@CodingWithAdam Cool. Thank you for the response. I'm going to use your methods in VSCode and keep pursuing getting VS 2022 working, as well. Thank you for the great, thorough content!

    • @CodingWithAdam
      @CodingWithAdam  ปีที่แล้ว

      You’re welcome! That’s good to hear 😀