Skip to content

epicweb-dev/mocking-techniques

Repository files navigation

Mocking Techniques in Vitest

Everything to know about mocking in TypeScript.


Build Status GPL 3.0 License Code of Conduct

Prerequisites

You don't have to have any prior experience with automated testing to complete this workshop. Having a basic experience with JavaScript, however, is required as we won't be covering things like objects, functions, imports/exports as a part of this workshop.

Pre-workshop Resources

Feel free to go through the additional resources below before, during, or after the workshop. They are here to set you on the right track of thinking about automated testing, as well as expand on the concepts and practices we will be covering during the workshop.

System Requirements

  • git v2.18 or greater;
  • NodeJS v20.11.0 or greater;
  • npm v8 or greater.

All of these must be available in your PATH. To verify things are set up properly, you can run this:

git --version
node --version
npm --version

If you have trouble with any of these, learn more about the PATH environment variable and how to fix it here for windows or mac/linux.

Setup

Follow these steps to get this set up:

git clone --depth 1 https://github.com/epicweb-dev/mocking-techniques.git
cd mocking-techniques
npm run setup

If you experience errors here, please open an issue with as many details as you can offer.

Important

Don't forget to run the npm run setup step!

Exercises

You will find all the exercises in the exercises directory. You will be progressing through the workshop in the workshop app (more on that below) and working on every exercise in your code editor of choice.

Note that the purpose of the exercise is not to skim through it and continue. In every exercise, you will get a real-world problem and you will be tasked with fixing it. There will be plenty of information and hints to assist you on your path but it is by tackling the problems head-on what will make those learnings stick.

Running the App

To get the app up and running, run:

npm start

Open the address printed in the terminal in the browser, and you're good to go!

The Workshop App

Learn all about the workshop app on the Epic Web Getting Started Guide.

Kent with the workshop app in the background