介绍 Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。 在 Vue School 学习如何测试 Vue.js 组件 教程 起步 常用技巧 鼠标、键盘以及其它 DOM 事件 选择一个测试运行器 用 Jest 测试单文件组件 用 Mocha 和 webpack 测试单文件组件 用 Karma 测试单文件组件 无需构建在 Node.js 中测试 测试异步行为 配合 TypeScript 使用 配合 Vue Router 使用 配合 Vuex 使用 有用的测试库 API mount shallowMount render renderToString 挂载选项 context slots scopedSlots stubs mocks localVue attachToDocument attrs propsData listeners parentComponent provide 其它选项 Wrapper attributes classes contains emitted emittedByOrder exists destroy find findAll get html is isEmpty isVueInstance name props setChecked setData setMethods setProps setSelected setValue text trigger isVisible WrapperArray at contains exists destroy filter is isEmpty isVueInstance setChecked setData setMethods setProps setValue trigger isVisible 组件 RouterLinkStub 选择器 createWrapper createLocalVue 配置