~/talk

7 ways to make your Vue unit tests better

Talkat VueConf Toronto 2021 · 2021-11-22..11-23· [vue, testing]
slides:none on file

Seven concrete practices for Vue unit tests: use Vue Test Utils with Jest, build a small createComponent factory to centralize shallowMount options and teardown, prefer shallowMount so child components stay black boxes, and replace repetitive wrapper.find selectors with named helpers. Assert the rendered template, emitted events, and side effects instead of wrapper.vm internals or spying on methods, wait for Vue microtasks with nextTick, and note that at GitLab about 80% of merge comments focus on unit tests.

AI-written summary · about

  1. 0:00Introduction to vue testing
  2. 2:24Defining component output
  3. 4:23Structuring tests effectively
  4. 6:45Using component factories
  5. 9:03Implementing element helpers
  6. 12:08Avoiding internal testing
  7. 17:32Best practices summary
  8. 21:51Handling components and ticks
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.