~/talk

7 ways to make your Vue unit tests better

Talkat vueday 2023 · on Friday, 2023-11-10· [testing, vue]
slides:none on file

Advocates switching back to Vue Test Utils (VTU) over Testing Library for Vue specifics, uses data-test-id attributes and small finder helpers, and prefers shallowMount not mount so parent tests treat children as black boxes. Tests assert rendered HTML, emits, and mocked API calls (checks that the mock was called), avoid wrapper.vm introspection, use input helpers like setValue + await nextTick, make tests fail before passing, and use coverage lines to spot untested branches.

AI-written summary · about

  1. 0:00Introduction
  2. 1:27Unit tests matter
  3. 3:57Component output
  4. 7:12Test coverage structure
  5. 10:06Data test IDs
  6. 14:02Avoid internals
  7. 17:49Shallow vs full mount
  8. 21:01Disabled states
  9. 24:19Fail tests early
  10. 27:19Mock API calls
  11. 29:46Resilient tests
  12. 31:13Unit vs E2E trade-offs
  13. 32:40Data test IDs in code
  14. 34:06Testing resources
  15. 35:31What to test
  16. 36:35Test helpers
  17. 37:40AI tools for testing
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.