RepositoryJavaScriptDEĐức
posva

posva/vuex-mock-store

✅Simple and straightforward Vuex Store mock for vue-test-utils

270sao
19fork
3issue
1lượt xem

🧪 vuex-mock-store: Mock Vuex nhanh cho test component Vue

Tự động spy commit và dispatch, test component mà không chạy logic store thật.

vuex-mock-store là công cụ mock nhẹ cho Vuex (v3.x/v4.x), hỗ trợ Vue 2 và Vue 3. Dùng với vue-test-utils và Jest để kiểm thử component mà không cần thực thi mutations/actions thật.

✨ Điểm nổi bật

  • Tự động spy: Tạo sẵn spy cho commit và dispatch.
  • Hỗ trợ Vue 2/3: Tương thích Vuex v3.x và v4.x.
  • Mock state/getters: Cung cấp state và getters giả lập.
  • Hỗ trợ module: Mock state/getters/actions theo cấu trúc module lồng nhau.
  • Dễ tích hợp: Dùng với vue-test-utils qua cấu hình mocks.
  • Tùy chỉnh spy: Hỗ trợ thay thế bằng thư viện mock khác như Sinon.
  • Reset dễ dàng: Gọi store.reset() để đặt lại spy và trạng thái ban đầu.

💡 Vì sao đáng chú ý

Không cần viết thủ công các hàm mock phức tạp — thư viện tự động tạo spy cho commit và dispatch, giúp test component nhanh chóng mà không phụ thuộc vào logic store thực tế. Phù hợp với dự án Vue sử dụng Vuex và Jest.


#Vue #Vuex #Testing #Jest #MockStore #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryJavaScript
vuejs/vuex

🗃️ Centralized State Management for Vue.js.

28.3k
Sep 25, 2024
RepositoryJavaScript
PanJiaChen/vue-admin-template

a vue2.0 minimal admin template

20.3k
Apr 27, 2024
RepositoryTypeScript
vuejs/pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support

14.8k
Dec 1, 2026
RepositoryC#
nsubstitute/NSubstitute

A friendly substitute for .NET mocking libraries.

3.0k
Nov 16, 2026
RepositoryTypeScript
nvh95/jest-preview

Debug your Jest tests. Effortlessly.🛠🖼

2.4k
Apr 25, 2026
RepositoryTypeScript
smocker-dev/smocker

Smocker is a simple and efficient HTTP mock server and proxy

1.3k
Nov 28, 2026
RepositoryTypeScript
help-me-mom/ng-mocks

Angular testing library for mocking components, directives, pipes, services and facilitating TestBed setup

1.2k
Nov 25, 2026
RepositoryTypeScript
marchaos/jest-mock-extended

Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended

908
Oct 8, 2026
RepositoryVue
Neveryu/vue-cms

基于 Vue 和 ElementUI 构建的一个企业级后台管理系统

649
May 20, 2026