createErrorTestComponents() — vue Function Reference
Architecture documentation for the createErrorTestComponents() function in error-handling.spec.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 51187270_4aae_e276_a812_5f4f569ebde9["createErrorTestComponents()"] 5f768e1f_803a_b0bb_2158_66e99b80cba8["error-handling.spec.ts"] 51187270_4aae_e276_a812_5f4f569ebde9 -->|defined in| 5f768e1f_803a_b0bb_2158_66e99b80cba8 style 51187270_4aae_e276_a812_5f4f569ebde9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
test/unit/features/error-handling.spec.ts lines 265–451
function createErrorTestComponents() {
const components: any = {}
// data
components.data = {
data() {
throw new Error('data')
},
render(h) {
return h('div')
}
}
// render error
components.render = {
render(h) {
throw new Error('render')
}
}
// lifecycle errors
;['create', 'mount', 'update', 'destroy'].forEach(hook => {
// before
const before = 'before' + hook.charAt(0).toUpperCase() + hook.slice(1)
const beforeComp = (components[before] = {
props: ['n'],
render(h) {
return h('div', this.n)
}
})
beforeComp[before] = function () {
throw new Error(before)
}
const beforeCompAsync = (components[`${before}Async`] = {
props: ['n'],
render(h) {
return h('div', this.n)
}
})
beforeCompAsync[before] = function () {
return new Promise((resolve, reject) => reject(new Error(before)))
}
// after
const after = hook.replace(/e?$/, 'ed')
const afterComp = (components[after] = {
props: ['n'],
render(h) {
return h('div', this.n)
}
})
afterComp[after] = function () {
throw new Error(after)
}
const afterCompAsync = (components[`${after}Async`] = {
props: ['n'],
render(h) {
return h('div', this.n)
}
})
afterCompAsync[after] = function () {
return new Promise((resolve, reject) => reject(new Error(after)))
}
})
// directive hooks errors
;['bind', 'update', 'unbind'].forEach(hook => {
const key = 'directive ' + hook
const dirComp: any = (components[key] = {
props: ['n'],
template: `<div v-foo="n">{{ n }}</div>`
})
const dirFoo = {}
dirFoo[hook] = function () {
throw new Error(key)
}
dirComp.directives = {
foo: dirFoo
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createErrorTestComponents() do?
createErrorTestComponents() is a function in the vue codebase, defined in test/unit/features/error-handling.spec.ts.
Where is createErrorTestComponents() defined?
createErrorTestComponents() is defined in test/unit/features/error-handling.spec.ts at line 265.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free