https://github.com/jackmellis/vuenit
Vue Unit Test Helpers for server-side testing of client-side code
https://github.com/jackmellis/vuenit
Last synced: 4 months ago
JSON representation
Vue Unit Test Helpers for server-side testing of client-side code
- Host: GitHub
- URL: https://github.com/jackmellis/vuenit
- Owner: jackmellis
- Created: 2017-01-19T10:27:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-16T08:06:13.000Z (over 6 years ago)
- Last Synced: 2025-06-15T03:17:38.637Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 347 KB
- Stars: 36
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
- awesome-vue - vuenit - Vue Unit Test Helpers for server-side testing of client-side code ` 📝 3 years ago` (Dev Tools [🔝](#readme))
- awesome-vue-zh - 沃尼特 - 用于测试Vue组件和指令的实用工具. (叫研发工具组 / 试验)
- awesome-vue - vuenit - Utilities for testing Vue components and directives. (Components & Libraries / Dev Tools)
- awesome-vue - vuenit ★37 - Utilities for testing Vue components and directives. (Dev Tools / Test)
- awesome-vue - vuenit - Utilities for testing Vue components and directives. (Dev Tools / Test)
README
# vuenit
Vue Unit Test Helpers
[](https://badge.fury.io/js/vuenit)
[](https://travis-ci.org/jackmellis/vuenit)
[](https://codeclimate.com/github/jackmellis/vuenit)
[](https://codeclimate.com/github/jackmellis/vuenit/coverage)
Vuenit is a testing utility that offers a number of useful methods to make testing Vue applications easier:
- Easily mount Vue components
- Test directives
- Search the DOM for component instances
- Inject dependencies into components
- Test slots
- Update *data* and *props* on the fly
- Shallow rendering
- Mocked versions of __Vuex__, __Vue-Router__, and a __$http__ module to make testing with dependencies easier
```
npm install vuenit --save-dev
```
```js
import {mount, mockRouter, mockHttp, mockStore} from 'vuenit';
import c from 'path/to/component';
const {$router} = mockRouter();
const $http = mockHttp();
const $store = mockStore();
const options = {
inject : { $router, $http, $store },
props : { userId : 'x4' },
stubComponents : true
};
const vm = mount(c, options);
```
__Vuenit__ has a huge array of configuration options for different testing scenarios. For full documentation, see [https://jackmellis.gitbooks.io/vuenit/content](https://jackmellis.gitbooks.io/vuenit/content)