@vue/test-utils
The next iteration of Vue Test Utils. It targets Vue 3.
Last updated 7 years ago by lmiller1990 .
MIT · Original npm · Tarball · package.json
$ npm install @vue/test-utils 
SYNC missed versions from official npm registry.

vue-test-utils-next

The next iteration of Vue Test Utils. It targets Vue 3.

Installation and Usage

  • yarn: yarn add @vue/test-utils@next --dev
  • npm: npm install @vue/test-utils@next --save-dev

Coming from Vue 2 + Vue Test Utils beta?

We are working on some documentation to help people migrate. At this point it will you will have better luck trying this out with a brand new Vue 3 app, as opposed to upgrading an existing Vue 2 app. Feedback and bug reports are welcome!

Working with .vue files

There is vue-jest for loading .vue files into Jest. The next branch contains support for Vue 3. Install it with yarn add vue-jest@next. It lacks support for some things, namely JSX.

If you don't want to configure things, you can download a repository with Vue 3, @vue/test-utils@next, vue-jest@next and TypeScript configured here.

Docs

Docs are located in this repo. Read them here. They are in a separate repository because running Vuepress alongside a repo with Vue 3 causes conflicts - Vuepress expects to be running against Vue 2. This seems like the most simple solution for now.

Development

It's a pretty small codebase at the moment. Get started by running yarn install. You can run the tests with yarn test. That's it!

There is a lot of work to do. See issues for some basic TODOs, or the table at the bottom of this page.

What works?

See the docs. Most basic DOM interactions work. Advanced features like shallowMount and stubs are a work in progress.

Contributing

This is still very much alpha - if you want to add a feature, have a hack or ping someone in Discord to chat, or check out the issues and project board.

Where is shallowMount

It's coming soon. We are working on it. Stay tuned!

Comparsion with Vue Test Utils beta (targeting Vue 2)

This is table for those coming from VTU beta, comparing the two APIs. A lot of things are still a work in progress.

  • ✅ - implemented
  • ❌ - not yet implemented
  • ⚰️ - will not be implemented (if you have a compelling use case, please open an issue)

Mounting Options

option status notes
data ✅
slots ✅ has not been tested vigorously. Please try it out.
mocks ✅ nested in global
propsData ✅ now called props
provide ✅ nested in global
mixins ✅ (new!) nested in global
plugins ✅ (new!) nested in global
component ✅ (new!) nested in global
directives ✅ (new!) nested in global
stubs ✅
attachToDocument ✅ renamed attachTo. See here
attrs ⚰️ use props instead, it assigns both attributes and props.
scopedSlots ⚰️ scopedSlots are merged with slots in Vue 3
context ⚰️ different from Vue 2, does not make sense anymore.
localVue ⚰️ may not make sense anymore since we do not mutate the global Vue instance in Vue 3.
listeners ⚰️ no longer exists in Vue 3
parentComponent ⚰️

Wrapper API (mount)

method status notes
attributes ✅
classes ✅
exists ✅
find ✅ only querySelector syntax is supported. find(Comp) under discussion here
emitted ✅
findAll ✅ see above. .vm is different to Vue 2. We are exploring options.
get ✅
html ✅
setValue ✅ works for select, checkbox, radio button, input, textarea. Returns nextTick.
text ✅
trigger ✅ returns nextTick. You can do await wrapper.find('button').trigger('click')
setProps ✅
props ✅
setData ❌ has PR
destroy ✅ renamed to unmount to match Vue 3 lifecycle hook name.
props ✅
contains ⚰️ use find
emittedByOrder ⚰️ use emitted
setSelected ⚰️ now part of setValue
setChecked ⚰️ now part of setValue
is ⚰️
isEmpty ⚰️ use matchers such as this
isVisible ⚰️ use matchers such as this
isVueInstance ⚰️
name ⚰️
setMethods ⚰️

Current Tags

  • 2.0.0-alpha.0                                ...           2.0.0-alpha.0 (7 years ago)
  • 2.0.0-alpha.1                                ...           2.0.0-alpha.1 (7 years ago)
  • 2.0.0-alpha.2                                ...           2.0.0-alpha.2 (7 years ago)
  • 2.0.0-alpha.3                                ...           2.0.0-alpha.3 (7 years ago)
  • 2.0.0-alpha.4                                ...           2.0.0-alpha.4 (7 years ago)
  • 2.0.0-alpha.8                                ...           2.0.0-alpha.8 (6 years ago)
  • 2.0.0-beta.1                                ...           2.0.0-beta.1 (6 years ago)
  • 2.0.0-beta.10                                ...           2.0.0-beta.10 (6 years ago)
  • 2.0.0-beta.12                                ...           2.0.0-beta.12 (6 years ago)
  • 2.0.0-beta.13                                ...           2.0.0-beta.13 (6 years ago)
  • 2.0.0-beta.2                                ...           2.0.0-beta.2 (6 years ago)
  • 2.0.0-beta.3                                ...           2.0.0-beta.3 (6 years ago)
  • 2.0.0-beta.4                                ...           2.0.0-beta.4 (6 years ago)
  • 2.0.0-beta.5                                ...           2.0.0-beta.5 (6 years ago)
  • 2.0.0-beta.7                                ...           2.0.0-beta.7 (6 years ago)
  • 2.0.0-beta.8                                ...           2.0.0-beta.8 (6 years ago)
  • 2.0.0-beta.9                                ...           2.0.0-beta.9 (6 years ago)
  • 2.0.0-rc.0                                ...           2.0.0-rc.0 (6 years ago)
  • 2.0.0-rc.1                                ...           2.0.0-rc.1 (6 years ago)
  • 2.0.0-rc.10                                ...           2.0.0-rc.10 (5 years ago)
  • 2.0.0-rc.11                                ...           2.0.0-rc.11 (5 years ago)
  • 2.0.0-rc.12                                ...           2.0.0-rc.12 (5 years ago)
  • 2.0.0-rc.14                                ...           2.0.0-rc.14 (5 years ago)
  • 2.0.0-rc.16                                ...           2.0.0-rc.16 (5 years ago)
  • 2.0.0-rc.18                                ...           2.0.0-rc.18 (5 years ago)
  • 2.0.0-rc.2                                ...           2.0.0-rc.2 (6 years ago)
  • 2.0.0-rc.3                                ...           2.0.0-rc.3 (6 years ago)
  • 2.0.0-rc.4                                ...           2.0.0-rc.4 (6 years ago)
  • 2.0.0-rc.5                                ...           2.0.0-rc.5 (6 years ago)
  • 2.0.0-rc.6                                ...           2.0.0-rc.6 (6 years ago)
  • 2.0.0-rc.7                                ...           2.0.0-rc.7 (5 years ago)
  • 2.0.0-rc.8                                ...           2.0.0-rc.8 (5 years ago)
  • 2.0.0-rc.9                                ...           2.0.0-rc.9 (5 years ago)
  • 2.4.0-alpha.0                                ...           2.4.0-alpha.0 (4 years ago)
  • 2.5.1                                ...           latest (2 months ago)
  • 1.3.6                                ...           legacy (3 years ago)
  • 2.4.0-alpha.2                                ...           next (3 years ago)
  • 2.4.0-alpha.2                                ...           v2.4.0-alpha.2 (3 years ago)

126 Versions

  • 2.5.1                                ...           2 months ago
  • 2.5.0                                ...           3 months ago
  • 2.4.11                                ...           6 months ago
  • 2.4.10                                ...           7 months ago
  • 2.4.9                                ...           7 months ago
  • 2.4.8                                ...           7 months ago
  • 2.4.7                                ...           7 months ago
  • 2.4.6                                ...           3 years ago
  • 2.4.5                                ...           3 years ago
  • 2.4.4                                ...           3 years ago
  • 2.4.3                                ...           3 years ago
  • 2.4.2                                ...           3 years ago
  • 2.4.1                                ...           3 years ago
  • 2.4.0                                ...           3 years ago
  • 1.3.6                                ...           3 years ago
  • 2.4.0-alpha.2                                ...           3 years ago
  • 2.4.0-alpha.1                                ...           4 years ago
  • 2.4.0-alpha.0                                ...           4 years ago
  • 1.3.5                                ...           4 years ago
  • 2.3.2                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.10                                ...           4 years ago
  • 2.2.9                                ...           4 years ago
  • 2.2.8                                ...           4 years ago
  • 1.3.4                                ...           4 years ago
  • 2.2.7                                ...           4 years ago
  • 2.2.6                                ...           4 years ago
  • 2.2.5                                ...           4 years ago
  • 2.2.4                                ...           4 years ago
  • 2.2.3                                ...           4 years ago
  • 2.2.2                                ...           4 years ago
  • 1.3.3                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 2.2.1                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           5 years ago
  • 2.0.0-rc.21                                ...           5 years ago
  • 2.0.0-rc.20                                ...           5 years ago
  • 2.0.0-rc.19                                ...           5 years ago
  • 2.0.0-rc.18                                ...           5 years ago
  • 2.0.0-rc.17                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 2.0.0-rc.16                                ...           5 years ago
  • 2.0.0-rc.15                                ...           5 years ago
  • 2.0.0-rc.14                                ...           5 years ago
  • 2.0.0-rc.13                                ...           5 years ago
  • 2.0.0-rc.12                                ...           5 years ago
  • 2.0.0-rc.11                                ...           5 years ago
  • 1.2.2                                ...           5 years ago
  • 2.0.0-rc.10                                ...           5 years ago
  • 2.0.0-rc.9                                ...           5 years ago
  • 2.0.0-rc.8                                ...           5 years ago
  • 2.0.0-rc.7                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           6 years ago
  • 2.0.0-rc.6                                ...           6 years ago
  • 2.0.0-rc.5                                ...           6 years ago
  • 1.1.4                                ...           6 years ago
  • 2.0.0-rc.4                                ...           6 years ago
  • 2.0.0-rc.3                                ...           6 years ago
  • 2.0.0-rc.2                                ...           6 years ago
  • 2.0.0-rc.1                                ...           6 years ago
  • 1.1.3                                ...           6 years ago
  • 2.0.0-rc.0                                ...           6 years ago
  • 2.0.0-beta.14                                ...           6 years ago
  • 2.0.0-beta.13                                ...           6 years ago
  • 1.1.2                                ...           6 years ago
  • 2.0.0-beta.12                                ...           6 years ago
  • 2.0.0-beta.11                                ...           6 years ago
  • 2.0.0-beta.10                                ...           6 years ago
  • 2.0.0-beta.9                                ...           6 years ago
  • 1.1.1                                ...           6 years ago
  • 2.0.0-beta.8                                ...           6 years ago
  • 2.0.0-beta.7                                ...           6 years ago
  • 2.0.0-beta.6                                ...           6 years ago
  • 2.0.0-beta.5                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 2.0.0-beta.4                                ...           6 years ago
  • 1.0.5                                ...           6 years ago
  • 2.0.0-beta.3                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 2.0.0-beta.2                                ...           6 years ago
  • 2.0.0-beta.1                                ...           6 years ago
  • 2.0.0-beta.0                                ...           6 years ago
  • 2.0.0-alpha.8                                ...           6 years ago
  • 2.0.0-alpha.7                                ...           6 years ago
  • 1.0.3                                ...           7 years ago
  • 2.0.0-alpha.6                                ...           7 years ago
  • 2.0.0-alpha.5                                ...           7 years ago
  • 2.0.0-alpha.4                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
  • 2.0.0-alpha.3                                ...           7 years ago
  • 2.0.0-alpha.2                                ...           7 years ago
  • 2.0.0-alpha.1                                ...           7 years ago
  • 2.0.0-alpha.0                                ...           7 years ago
  • 1.0.0-beta.33                                ...           7 years ago
  • 1.0.0-beta.32                                ...           7 years ago
  • 1.0.0-beta.31                                ...           7 years ago
  • 1.0.0-beta.30                                ...           7 years ago
  • 1.0.0-beta.29                                ...           8 years ago
  • 1.0.0-beta.28                                ...           8 years ago
  • 1.0.0-beta.27                                ...           8 years ago
  • 1.0.0-beta.26                                ...           8 years ago
  • 1.0.0-beta.25                                ...           8 years ago
  • 1.0.0-beta.24                                ...           8 years ago
  • 1.0.0-beta.23                                ...           8 years ago
  • 1.0.0-beta.22                                ...           8 years ago
  • 1.0.0-beta.21                                ...           8 years ago
  • 1.0.0-beta.20                                ...           8 years ago
  • 1.0.0-beta.19                                ...           8 years ago
  • 1.0.0-beta.18                                ...           8 years ago
  • 1.0.0-beta.17                                ...           8 years ago
  • 1.0.0-beta.16                                ...           9 years ago
  • 1.0.0-beta.15                                ...           9 years ago
  • 1.0.0-beta.14                                ...           9 years ago
  • 1.0.0-beta.13                                ...           9 years ago
  • 1.0.0-beta.12                                ...           9 years ago
  • 1.0.0-beta.11                                ...           9 years ago
  • 1.0.0-beta.10                                ...           9 years ago
Downloads
Total 453
Today 0
This Week 1
This Month 157
Last Day 0
Last Week 8
Last Month 295
Dependencies (2)
Dev Dependencies (29)

© 2010 - cnpmjs.org x YWFE | Home | YWFE