errorCaptured.spec.ts — vue Source File
Architecture documentation for errorCaptured.spec.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3fc5cb80_d36f_7a82_f933_f9874c0b48ad["errorCaptured.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] 3fc5cb80_d36f_7a82_f933_f9874c0b48ad --> db9e7bef_009d_3918_6e7d_543a36a38d75 style 3fc5cb80_d36f_7a82_f933_f9874c0b48ad fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Vue from 'vue'
describe('Options errorCaptured', () => {
let globalSpy
beforeEach(() => {
globalSpy = Vue.config.errorHandler = vi.fn()
})
afterEach(() => {
Vue.config.errorHandler = undefined
})
it('should capture error from child component', () => {
const spy = vi.fn()
let child
let err
const Child = {
created() {
child = this
err = new Error('child')
throw err
},
render() {}
}
new Vue({
errorCaptured: spy,
render: h => h(Child)
}).$mount()
expect(spy).toHaveBeenCalledWith(err, child, 'created hook')
// should propagate by default
expect(globalSpy).toHaveBeenCalledWith(err, child, 'created hook')
})
it('should be able to render the error in itself', done => {
let child
const Child = {
created() {
child = this
throw new Error('error from child')
},
render() {}
}
const vm = new Vue({
data: {
error: null
},
errorCaptured(e, vm, info) {
expect(vm).toBe(child)
this.error = e.toString() + ' in ' + info
},
render(h) {
if (this.error) {
return h('pre', this.error)
}
return h(Child)
// ... (367 more lines)
Dependencies
- vue
Source
Frequently Asked Questions
What does errorCaptured.spec.ts do?
errorCaptured.spec.ts is a source file in the vue codebase, written in typescript.
What does errorCaptured.spec.ts depend on?
errorCaptured.spec.ts imports 1 module(s): vue.
Where is errorCaptured.spec.ts in the architecture?
errorCaptured.spec.ts is located at test/unit/features/options/errorCaptured.spec.ts (directory: test/unit/features/options).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free