VueUnit is a new library for Vue.js that makes it easier to create and unit test components. The project pages claims:
- Easily test props, events, and slots (including named slots)
- Optionally shallow render components
- Simulate simple DOM events (click, input, etc.)
- Use any test runner / assertion library
VueUnit renders all components in the DOM and needs to handle setup and tear down. VueUnit provides two helpers for this:
beforeEachHooks()
andafterEachHooks()
when need to be called before and after each test, respectively.
The readme contains several examples in mocha, chai, sinon, and chai-jquery to get you started but it’s not limited to those. If you are interested in unit testing your Vue.js app, definitely check out this package.