inflearn logo

From Jest to Vitest, Introduction to JS Test Code

We may feel the need to write test codes, but when we actually start, the syntax and concepts feel so unfamiliar that it's hard to get into. Even when following examples, it's often confusing which matcher to use after `expect`, when mocks and spies are necessary, or how to verify asynchronous code. This course is designed for those new to JavaScript testing to step-by-step master the fundamentals of testing based on Jest, and then naturally transition to Vitest. Rather than simply saying "this is how you use it," we explain from a beginner's perspective why test functions should be separated, why export/import is necessary, and what values should be verified to create a good test. By following the course, students will progressively learn the basic structure of unit tests, how to use matchers, testing synchronous code, mocks and spies, and even asynchronous code and API mocking. Through this, you can build a foundation to verify behavior with test codes and refactor with confidence, instead of anxiously clicking through things manually every time you modify a feature.

25 learners are taking this course

Level Beginner

Course period Unlimited

Jest
Jest
vitest
vitest
unittest
unittest
msw
msw
Jest
Jest
vitest
vitest
unittest
unittest
msw
msw

What you will gain after the course

  • You can understand why test code is necessary and write basic unit tests yourself using Jest.

  • You can understand the roles of describe, it, expect, and matcher, and construct test code appropriate for the values you want to verify.

  • You can more accurately verify the behavior of actual code by testing synchronous functions, testing multiple cases, and utilizing Mock functions and Spies.

  • You can understand the flow of transitioning from Jest to Vitest and establish criteria for selecting testing tools that fit the modern frontend development environment.

  • By mastering the basic methods for testing asynchronous code and API requests, you can write stable tests that do not depend on the network.

Recommended for
these people

Who is this course right for?

  • JavaScript beginners who feel the need to learn test code but feel overwhelmed and don't know where to start because terms like describe, it, and expect are unfamiliar.

  • Frontend developers who have followed Jest examples before but still don't have a feel for which values to verify or how to choose the right matchers.

  • Developers who feel anxious before refactoring or deployment because they manually check every feature in the browser whenever they make a change.

  • Developers who keep putting off writing test code because concepts like Mock, Spy, asynchronous testing, and API mocking feel difficult.

  • Developers who want to move from Jest to Vitest but want to organize the differences between the two tools and the migration flow all at once.

Need to know before starting?

  • It is recommended to take this course if you are familiar with the basic syntax of JavaScript.

Hello
This is potatosam

Career Verified

178

Learners

6

Reviews

2

Answers

5.0

Rating

8

Courses

Hello, I'm Potato-ssam, a frontend developer with 4 years of experience.

Currently, I am developing a global mobility service. I have gained practical experience by building multilingual services and am also a global Top 30 contributor to the open-source library react-hook-form, which is used by developers worldwide.

But I wasn't always like this from the start.

When I first learned JS, I felt like I understood everything while following along with YouTube tutorials, but I countless times experienced my mind going blank the moment I opened an empty editor. At first, I was just busy copying and pasting code I found on Google, and when an error occurred, I didn't know where to start, so I would stay up all night and spend days in frustration.

I struggled a lot during that process. I wrote code without even knowing what the DOM was, and I wasted hours because I didn't understand why an event was firing twice. What I needed most back then wasn't memorizing vast amounts of syntax. It was someone who could explain "why this code actually works."

I created this course by organizing everything I've built up over four years of practical experience, along with the areas where I struggled the most as a beginner. You don't have to take the long way around like I did. I've already been through it for you.

More

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

potatosam's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Free