Jest extensions compatible with Vue Test Utils ✨
.toHaveEmitted
- Check if a @vue/test-utils wrapper has emitted the given event.toHaveEmittedPayload
- Check if a @vue/test-utils has emitted an event with the given payload.toExist
- Pass if wrapper exists.toBeVisible
- Pass if wrapper is not visible
yarn add -D vue-jest-extended
In your jest configuration:
"jest": {
...
"setupFilesAfterEnv": ["vue-jest-extended"]
...
}
"jest": {
...
"setupTestFrameworkScriptFile": "vue-jest-extended"
...
}
alternatively if you want to combine these matchers with other matchers in your project
"jest": {
...
"setupTestFrameworkScriptFile": "./extensions.js"
...
}
/* extensions.js */
import 'vue-jest-extended;
// require('vue-jest-extended);
MIT