10 DAYS AGO • 1 MIN READ

(#9) How to test Angular / React / Vue? 🙉 (60 seconds tip)

profile

pills.dev 💊 weekly coding tips & tricks

Join +2,660 software developers getting weekly tips covering security, quality and system design.

How can we unit test front-end Single-Page Applications?

You can do it in three different ways:

  1. Isolated testing - no DOM rendering / just JavaScript
    1. the fastest ✅
    2. the least reliable ❌
  2. Shallow testing - (partial DOM rendering)
    1. the compromise between isolated and integrated 👍
  3. Deep / integrated testing - (full DOM rendering)
    1. the slowest ❌
    2. the most reliable ✅

Visually, it looks like that:

In Angular, you can control what gets rendered based on what you import and declare in TestBed.

In React and Vue, you can use different rendering methods.

Rate this email:

GREAT 😃 | OKEY 😐 | BAD 😟

All the best,
Bartosz

pills.dev 💊 weekly coding tips & tricks

Join +2,660 software developers getting weekly tips covering security, quality and system design.