w3cj / use-x

Practice implementing custom react hooks with full test suites and examples.
https://www.youtube.com/watch?v=GDXsuoisg60
MIT License
12 stars 4 forks source link

How to console.log / debug tests #2

Open Arinji2 opened 1 month ago

Arinji2 commented 1 month ago

Sorry had another issue, so how do we like console stuff out? It seems as if eslint has a console warn rule + i dont think console log works with testing.. are we not able to log out stuff?

w3cj commented 1 month ago

You will see all of the log outputs before the test results.

Screenshot 2024-10-17 at 8 24 39 AM

You can also try using the vitest extension: https://marketplace.visualstudio.com/items?itemName=vitest.explorer

This will allow you to run individual tests and see the output on the left:

Screenshot 2024-10-17 at 8 28 50 AM

You can also add break points in your code and press the play button with a bug on it, this will then stop the execution while the test is running and you can hover over variables / inspect the code during runtime:

Screenshot 2024-10-17 at 8 30 09 AM

Arinji2 commented 1 month ago

Awesome thankyou so much. I am new to testing in my react code so this challenge is awesome :D Again much appreciated for you helping me out <3

w3cj commented 1 month ago

Keeping this one open as well in case others have the same question.