Skip to content
Proyek

epicweb-dev/react-component-testing-with-vitest

Lihat di GitHub

Tentang

Test your React components in the actual browser with Vitest Browser Mode.

Pengembangan web dan aplikasi

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
Mengumpulkan riwayat
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

React Component Testing with Vitest

Learn how to test React components in the actual browser with Vitest.


Build Status GPL 3.0 License Code of Conduct

Prerequisites

You don't have to have any prior experience with Vitest or Vitest Browser Mode to complete this workshop.

  • A basic experience with TypeScript is required.
  • A basic experience with component-level testing is beneficial. This workshop works best if you've written component tests in the past. But don't worry if you haven't, you will write a bunch of those during the workshop!
  • Get familiar with React Testing Library, especially its Guiding Principles. You don't need to have any prior experience of using the library.

Pre-workshop Resources

Here are some resources you can read before taking the workshop to get you up to speed on some of the tools and concepts we'll be covering:

System Requirements

  • git v2.18 or greater
  • NodeJS v22 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

Use the Epic Workshop CLI to get this setup:

npx --yes epicshop@latest add react-component-testing-with-vitest

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

The Workshop App

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

Kent with the workshop app in the background

Troubleshooting

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'epicshop'

Reason: You likely have ignore-scripts=true in your .npmrc, which skips the postinstall script that installs the workshop app.

Solution: Remove ignore-scripts=true from your ~/.npmrc and run the setup command again.

Could not locate workshop-app directory

Reason: You ran npx epicshop start, which uses the globally installed epicshop CLI that cannot find the workshop app.

Solution: Either one of the following:

  • Run npm start in the workshop directory instead;
  • Install the workshop app globally with npm install -g @epic-web/workshop-app and run the epicshop start command again.

Jelajahi proyek terkait

Memuat…