Utilities for testing Vue.js components using Jest.
While written in TypeScript (and thus including type definitions), it can also be used in a pure JavaScript environment.
Disclaimer: this project is currently very much work-in-progress. The motivating use case is simplifying snapshot testing using a combination of Vue.js, TypeScript, Jest, and html2jade. Additional functionality will be added as needed and breaking API changes may happen before releasing 1.0. Contributions are more than welcome.
Usage
Install: npm install --save-dev vue-jest-utils
Note: Vue.js 2.0 and Jest must be installed as well.
To use Jest with Vue.js single-file components (*.vue
) or TypeScript sources, follow the guide on vue-typescript-jest.
For a complete example of a TypeScript/Tsify/Vue.js/Vueify/Pug setup supporting Hot Module Replacement and unit/snapshot testing with Jest, cf. vue-typescript-component-example.
Examples
JavaScript Test Example
const Vue = const VJU = const CounterJs =
TypeScript Test Example
/// describe'counter-ts.vue',
Contributing
Contributions including bug reports, tests, and documentation are more than welcome. To get started with development:
# once: install dependenciesnpm install# run unit tests in watch modenpm test -- --watch# lint & testnpm run prepublish