JavaScript Unit Testing Tutorial for Beginners

  Рет қаралды 46,612

Programming with Mosh

Programming with Mosh

Күн бұрын

Write bulletproof JavaScript code with unit testing! 💪 This beginner-friendly tutorial will teach you the essentials for cleaner, more reliable apps.
Key benefits of unit testing:
- Catch bugs early in development
- Boost confidence in your code
- Write better, more maintainable JavaScript
🚀 Want more?
- Check out my full JavaScript Unit Testing Course: bit.ly/javascript-unit-testing
- Subscribe for more videos like this: goo.gl/6PYaGF
✋ Stay connected for updates and exclusive content! Follow me on:
- Twitter: / moshhamedani
- Facebook: / programmingwithmosh
- Instagram: / codewithmosh.official
- LinkedIn: / codewithmosh
📖 TABLE OF CONTENT
0:00:00 Course Intro
0:01:21 Prerequisites
0:02:01 Course Structure
0:04:16 How to Take This Course
0:05:14 Setting Up the Testing Environment
0:05:46 Starter Project
0:06:40 Introduction to Unit Testing
0:08:19 What is Unit Testing?
0:13:39 Types of Tests
0:16:53 Choosing a Testing Framework
0:18:31 Setting Up Vitest
0:19:44 Writing Your First Test
0:29:04 Exercise: Testing fizzBuzz
0:35:00 Test-Driven Development
0:42:10 Exercise: Testing Factorial
#javascript #testing

Пікірлер: 102
@programmingwithmosh
@programmingwithmosh 16 күн бұрын
🚀 Want more? - Check out my full JavaScript Unit Testing Course: bit.ly/javascript-unit-testing - Subscribe for more videos like this: goo.gl/6PYaGF
@jonasn5
@jonasn5 8 күн бұрын
Hello Mosh, I am trying to use this as a baseline to try some of my own js unittest. but I am meeting an issue of initializing when i try to define a custom class in one of the .js files then importing it. Do you have an idea what is causing this issue?
@invertedcoder
@invertedcoder 3 ай бұрын
Mosh sir i started coding by seeing you are my inpiration i hope you keep teaching and make others life better
@Tech050-jb5zu
@Tech050-jb5zu 2 ай бұрын
Thanks a million for the effort you made, Mosh! I’m learning Full-Stack development with your Clear & concise KZbin videos.
@amirhoseinshams256
@amirhoseinshams256 3 ай бұрын
This would be a great and useful course!💥🔥 دمت گرم داری!❤️
@harshbansal
@harshbansal 3 ай бұрын
Thank you thank you thank you Ben waiting for this 🥺❤️❤️
@user-si7pf9wm9p
@user-si7pf9wm9p 3 ай бұрын
Thank You! For Your Service! You are a Noce Person Dear Mosh Keep it up
@lorenainfanter.3099
@lorenainfanter.3099 Ай бұрын
This is the info that I was looking for! Thank you very much. I didn't know anything about testing, but with this video I learnt a lot!! The explanation was very clear and straightforward. Thanks again!!
@user-tx5yi7bk2r
@user-tx5yi7bk2r 2 ай бұрын
It's good to see you back But i was really excited to learn more about mechine learning. Please try to do more about it.❤
@vdevivaraprasad3588
@vdevivaraprasad3588 3 ай бұрын
I have started learning your React course. That course is osum i have never seen any instructed like you. You are making the coding as fun and also real world examples and projects. That's why everyone likes your style of teaching. But i have one doubt when you're gonna release part 3 of the ultimate react series. Eagerly waiting for that. Anyway thank you❤.
@bmarecords5183
@bmarecords5183 3 ай бұрын
Thanks so much for this course Mosh, you should also prepare one course on integration testing and testing react apps
@hosseinjafari2896
@hosseinjafari2896 16 сағат бұрын
You're doing amazing. Love from Iran😍
@abdelalikabou9197
@abdelalikabou9197 3 ай бұрын
Thank you so much mosh . Still learning from you 😉
@inspirechristians5789
@inspirechristians5789 3 ай бұрын
Mosh you are my model to be inspired
@kevinemugisha9035
@kevinemugisha9035 3 ай бұрын
Thanks Mosh, we love youuuuu
@MohammadMansourBone
@MohammadMansourBone 3 ай бұрын
We have been waiting for this course for a long time 😁
@Whisperywolf1269
@Whisperywolf1269 3 ай бұрын
best course ever
@kipfitpal
@kipfitpal 2 ай бұрын
Yay, Mosh is back !!!!
@lebogangsekwati4305
@lebogangsekwati4305 3 ай бұрын
This is the one thing I struggle with the most. I'm so excited for thjs
@russellmoore3418
@russellmoore3418 Ай бұрын
Excellent video, very well done!
@cppexplorery
@cppexplorery Ай бұрын
This man really does cool things. Thanks to him, I started making videos myself. I wish good luck to everyone who is learning. May everything work out for you 💪
@gfabasic32
@gfabasic32 2 ай бұрын
Thanks Mosh!
@user-lb2pl9qi6w
@user-lb2pl9qi6w 3 ай бұрын
Waiting ❤
@davood7497
@davood7497 2 ай бұрын
Mosh is back 💯💯💯
@Omar-jibril
@Omar-jibril 3 ай бұрын
Thanks Mosh
@ar-swe
@ar-swe 3 ай бұрын
love you mosh
@TroyTV5
@TroyTV5 25 күн бұрын
Your tutorials are amazing. Can you do one for Software testing?
@mehakgrover2174
@mehakgrover2174 2 ай бұрын
Hi Mosh
@monkamkelvin9115
@monkamkelvin9115 3 ай бұрын
I’m still waiting for your flutter course mosh …. You promised it since the react native course
@rafeeqshaik7355
@rafeeqshaik7355 3 ай бұрын
Me too broo
@ademineshat
@ademineshat 3 ай бұрын
Me tooo 😅 Let's Blow up this comment 🎉
@kristapsg3540
@kristapsg3540 3 ай бұрын
Me too!
@khaled.noordin
@khaled.noordin 3 ай бұрын
Flutter sukcs better focus on fp-ts lib.
@programmingwithdami
@programmingwithdami 3 ай бұрын
No he didn't
@shashankphatkure
@shashankphatkure Ай бұрын
thankyou very much sir :)
@mehmetaydar_QXyGeN
@mehmetaydar_QXyGeN 3 ай бұрын
Thank you so much :)
@valeriaguzman9620
@valeriaguzman9620 3 ай бұрын
I learned SQL with your content and I was able to land my first engineering position as a junior SRE ❤ thanks for sharing such valuable content.
@kinggrey2511
@kinggrey2511 3 ай бұрын
What does your work mostly consists of ?
@chandrashekharreddy5380
@chandrashekharreddy5380 3 ай бұрын
Ur just awesome
@balakrishnaprasad8928
@balakrishnaprasad8928 2 ай бұрын
Mosh Sir I beacame a fan of your teaching. Kindly create a course for Flask Framework and Fast API
@reza-bx8em
@reza-bx8em 2 ай бұрын
amazing!!!! پرچم همدان بالاست
@tsnaw8173
@tsnaw8173 2 ай бұрын
Mosh will there be a new react native course? Appreciate your hard work
@betterstack
@betterstack Ай бұрын
Great tutorial as always Mosh! If anyone’s looking for more JavaScript tutorials, we’ve released JS logging in Winston and Pino to help the community too 💪
@techsolutions4652
@techsolutions4652 2 ай бұрын
This is a humble request for making a playlist for Docker and AWS. Thanks in advance.
@Funny_bunny999
@Funny_bunny999 2 ай бұрын
OMG, You are getting younger day by day. However, sir you are an amazing teacher.
@JunaidKhan-hy5rr
@JunaidKhan-hy5rr 3 ай бұрын
Mosh Please upload project base courses on your websites, also courses on AWS
@minimalsforlife740
@minimalsforlife740 3 ай бұрын
Love u from the core of my fucking body cells. Im turned into a usd printing machine since I have become a react developer after I started learning to code using ur cources. Hope to see u in paradise in the other world Mosh❤🎉
@iffalcontcl6738
@iffalcontcl6738 2 ай бұрын
Hi mosh it would be greatful if you create a course on Machine learning. There is no clear path im seeing, i want the course like how you package things everything as one go ive purchased your react course its great everything is packaged very well. Kindy please consider this request.
@athulliapaulose
@athulliapaulose 2 ай бұрын
Waiting for the react testing course ❤
@AbhishekGupta-ji4pf
@AbhishekGupta-ji4pf 2 ай бұрын
Mosh sir, can you please do a comprehensive course on Springboot. Please, its a must after your Java course. Thanks.
@salamesalehpour
@salamesalehpour 2 ай бұрын
دمت گرم
@monkamkelvin9115
@monkamkelvin9115 3 ай бұрын
Mosh please your flutter course
@abdullaalfaiyaz1890
@abdullaalfaiyaz1890 2 ай бұрын
Hi mosh Are there any discounts available for your monthly all course subscription?
@anasouardini
@anasouardini 2 ай бұрын
I was about to learn Jest when I switched to wordpress since it appears that it's the only way to get a job as a junior.
@ghaatol
@ghaatol 2 ай бұрын
Mosh it's amazing watching your tutorials, I've learned a lot from you, can you please share your bashrc file with me.
@sina127458
@sina127458 3 ай бұрын
Hi mosh, Thanks to you for your videos. I from Iran and want to join coding world. But honestly I don't know with coding language is suitable for me. I like mobile app creating but I don't have any idea if the job market good or not. Can you please help me take the first step?
@abzz1290
@abzz1290 Ай бұрын
Hi, Which extensions are you using? if anyone know please do share.
@SRTIEP
@SRTIEP Ай бұрын
Flutter Mosh Please ❤
@malikarandolph8187
@malikarandolph8187 2 ай бұрын
I’m a beginner but want to eventually learn how to make my own daily planner mobile app that can be used on Android & iOS. I’ve been watching some of your videos and I love your teaching style. I’ve paid for the All Access Pass on your website but don’t know where to start. What languages should I learn to build my app?
@hk254lyt8
@hk254lyt8 2 ай бұрын
JavaScript
@tofaelahmed8255
@tofaelahmed8255 2 ай бұрын
Plz give us a tutorial about asynchronous JavaScript
@ashikahmedfahim232
@ashikahmedfahim232 2 ай бұрын
Flutter course please
@muhammadayazfaisal6786
@muhammadayazfaisal6786 2 ай бұрын
Sir Mosh can you please make a one huge project on JavaScript that covers every things like DOM, async, await and promises ,events and many more things.
@Bhushantbn
@Bhushantbn 2 ай бұрын
Which vs code theme you used??
@aminghasemi2621
@aminghasemi2621 2 ай бұрын
Hey mosh, Is it possible for you to create a NodeJS course with typescript and nest? I mean the nodejs full course is already awesome. But it could be much much better if you add these mastersy topics as well.
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Great suggestion!
@alfurquanzahedi8338
@alfurquanzahedi8338 2 ай бұрын
@programmingwithmosh can you please make a course on system design
@user-xq8jq2ex8y
@user-xq8jq2ex8y 2 ай бұрын
Hello Mosh, the course 'Angular 4: Beginner to Pro' can not be loaded. Could you check it?
@LearnwithSSRK
@LearnwithSSRK 2 ай бұрын
Pls upload JavaScript full tutorial video
@user-zc1xh4sj7n
@user-zc1xh4sj7n 2 ай бұрын
Dang, u really know what your fans want
@user-cg4ft5op9w
@user-cg4ft5op9w 2 ай бұрын
Is there a translation of the video into Arabic on your platform? I want to take the Django course???
@SabonaMarara
@SabonaMarara 2 ай бұрын
please i need full course thanks
@ishimweisaac1019
@ishimweisaac1019 2 ай бұрын
This 40 mins was worth watching
@minimalsforlife740
@minimalsforlife740 3 ай бұрын
Pls add course for ci/cd and docker for frontemd devs
@user-ze5ou8se6i
@user-ze5ou8se6i 2 ай бұрын
Flutter course would be a killer
@gd6noob
@gd6noob 2 ай бұрын
Windows vs macOS vs Linux for programming, which do you use and why?
@ayushmangarg2
@ayushmangarg2 3 ай бұрын
Please make a AIML course please
@adityapatil4287
@adityapatil4287 2 ай бұрын
Is spring boot still in demand in 2024. If yes Sir Mosh can we get a dedicated course on this topic. Please..!!!🙏
@raghavenderkuppireddy7158
@raghavenderkuppireddy7158 2 ай бұрын
❤❤❤❤❤❤
@LokeshKumar-tk7ri
@LokeshKumar-tk7ri 3 ай бұрын
Sir i have been asking for many months for a Complete DSA course using Javascript
@merzadev
@merzadev 2 ай бұрын
He already published a DSA course using Java they is no need i guess. Don't be married to the languages my thought
@fatokihabeeb4254
@fatokihabeeb4254 2 ай бұрын
hello Mosh sir i want to buy your course online but my card and country dosent support international transaction. ill like to know if i can buy the course with crypto currency i really need a fast reply from you sir.
@agatanor
@agatanor 3 ай бұрын
do you recommend vue js or react for beginners?
@_rachid
@_rachid 2 ай бұрын
Both are great. But you have to make your choice between the two based on the demand in the market you are targeting.
@user-zm1of2sf1s
@user-zm1of2sf1s 2 ай бұрын
react next
@mryasinize
@mryasinize 3 ай бұрын
But Mosh, how can I write tests for tests?
@nicolasm.bronner2747
@nicolasm.bronner2747 17 күн бұрын
You lost me on the "terminal" part... what terminal ? If it's on VS Code, it return an error 😥
@noorsajee7376
@noorsajee7376 Ай бұрын
Bro, I'm confused I watched the 48 minutes to learn JavaScript for beginners, i need practical videos to get me an examples from the practical life , to get me better to work as a frontend developer, please can you guide me I'm lost
@tomu_sange
@tomu_sange 3 ай бұрын
I think this course is mine.
@user-cg4ft5op9w
@user-cg4ft5op9w 2 ай бұрын
هل يوجد في منصتكم خاصيه الترجمه للغه العربيه
@deatho0ne587
@deatho0ne587 2 ай бұрын
Your test are only testing the good cases. What about if a new dev uses those functions that expect numbers but pass an array, string, an object, or something else? I agree with not over-engineering but this is still an issue with Unit test. They give a sense that the code is good but do not always make sure your code will not have bugs.
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
I’ve covered those in the full course.
@flywithoutwingss
@flywithoutwingss Ай бұрын
I just missed the early price 😅
@neciyvavian5223
@neciyvavian5223 2 ай бұрын
Is this beginners course, you need to really check the Java unit testing because when it come down to Fizz Buzz im getting fail test, im copy everything you did, and it feel like my money is wasted. No type of contact, I feel this is a scam😢
@ojomudamola6674
@ojomudamola6674 2 ай бұрын
How can subscribe with my Nigerian master card on your website, pls i really need this. Pls any discount, exchange rate is really high for a dollar to a naira
@aryanmangi9707
@aryanmangi9707 2 ай бұрын
Hey mosh let's talk business
@rafeeqshaik7355
@rafeeqshaik7355 3 ай бұрын
Micro services course using nodejs. 😢😢
@s.joseph4838
@s.joseph4838 2 ай бұрын
after i finish intro.test.js i go to my terminal and type npm t i get this error: Failed to load url ../src/intro (resolved id: ../src/intro) in C:/Users/snaus/javascript-testing-starter/src/tests/intro.test.js. Does the file exist? please help[
@fatokihabeeb4254
@fatokihabeeb4254 2 ай бұрын
hello Mosh sir i want to buy your course online but my card and country dosent support international transaction. ill like to know if i can buy the course with crypto currency i really need a fast reply from you sir.
React Testing for Beginners: Start Here!
1:17:14
Programming with Mosh
Рет қаралды 47 М.
Is Coding Still Worth Learning in 2024?
9:33
Programming with Mosh
Рет қаралды 114 М.
ФОКУС С ЧИПСАМИ (секрет)
00:44
Masomka
Рет қаралды 2,9 МЛН
Nonomen funny video😂😂😂 #magic
00:29
Nonomen ノノメン
Рет қаралды 59 МЛН
5 Types of Testing Software Every Developer Needs to Know!
6:24
Object-oriented Programming in JavaScript: Made Super Simple | Mosh
1:02:49
Programming with Mosh
Рет қаралды 1,9 МЛН
Every CSS Animation property
9:26
chunkydotdev
Рет қаралды 31 М.
Top Programming Languages to Learn in 2024 (For High-paying Jobs)
5:32
Programming with Mosh
Рет қаралды 144 М.
Test-Driven Development // Fun TDD Introduction with JavaScript
12:55
The FASTEST Way to Learn to Code & Get a Job
5:48
Programming with Mosh
Рет қаралды 62 М.
JavaScript Tutorial for Beginners: Learn JavaScript in 1 Hour
48:17
Programming with Mosh
Рет қаралды 12 МЛН
5 Mistakes That Are Killing Your Coding Progress
3:42
Programming with Mosh
Рет қаралды 29 М.
Build a Realtime Chat App in React Native (tutorial for beginners) 🔴
3:49:50
How to Get a Developer Job - Even in This Economy [Full Course]
3:59:46
freeCodeCamp.org
Рет қаралды 1,4 МЛН
ФОКУС С ЧИПСАМИ (секрет)
00:44
Masomka
Рет қаралды 2,9 МЛН