百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

avoriaz

> 前端框架
开源

Vue.js 测试实用程序库

749 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

Vue.js 测试实用程序库

avoriaz

a Vue.js testing utility library

Deprecation

This library will be deprecated once vue-test-utils is released.

Installation

bash
npm install --save-dev avoriaz

Documentation

Visit the docs

Examples

  • Example using karma and mocha
  • Example using karma and jasmine
  • Example using Jest
  • Example using mocha-webpack
  • Example using tape
  • Example using ava
Assert wrapper contains a child
javascript
import { mount } from 'avoriaz'
import Foo from './Foo.vue'

const wrapper = mount(Foo)
expect(wrapper.contains('.bar')).to.equal(true)
Shallow render components
javascript
import { shallow } from 'avoriaz'
import Foo from './Foo.vue'
import Bar from './Bar.vue'

const wrapper = shallow(Foo)
expect(wrapper.contains(Bar)).to.equal(true)
Assert style is rendered
javascript
const button = wrapper.find('div > button .button-child')[0]
expect(button.hasStyle('color', 'red')).to.equal(true)
Assert method is called when DOM event is triggered
javascript
const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
  propsData: { clickHandler }
})
wrapper.find('div .bar')[0].trigger('click')
expect(clickHandler.called).to.equal(true)
Assert wrapper contains text
javascript
const title = wrapper.find('h1.title')[0]
expect(title.text()).to.equal('some text')
Inject globals
javascript
const $route = { path: 'http://www.example-path.com' }
const wrapper = mount(Foo, { 
    globals: {
        $route
    }
})
expect(wrapper.vm.$route.path).to.equal($route.path)
Inject slots
javascript
const wrapper = mount(Foo, { 
    slots: {
        default: Foo
    }
})
Set data
javascript
wrapper.setData({
  someData: 'some data'
})

expect(wrapper.vm.someData).to.equal('some data')
Update props
javascript
wrapper.setProps({
  someProp: 'some prop',
  anotherProp: 'another prop'
})

For more examples, see the docs

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptavoriaztest-driven-developmenttestingtesting-tools

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架