Matchers for the emitted event on Vue component

Released jest-matcher-vue-test-utils v1.3.0

Kengo Hamasaki / hmsk
Hai-iro
1 min readDec 1, 2018

--

Added matchers to assert events on the Wrapper object by vue-test-utils.

toEmit

We can assert that the action emits the event (optionally, could check the payload too).

toHaveEmitted

This just asserts emission logs on wrapper.emitted() simply.

I would add similar matcher toHaveEmittedNth to assert not only the single event like the standard matcher toHaveBeenNthCalled by Jest.

Before releasing without “beta” tag, experimented with the actual Vue project on Indiegogo. Thanks, Super Famous Mike and Josh Dhaliwal for giving important feedback to these new matchers ✨

--

--