Home / File/ error-handling.spec.ts — vue Source File

error-handling.spec.ts — vue Source File

Architecture documentation for error-handling.spec.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.

File typescript VueCore VDom 1 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  5f768e1f_803a_b0bb_2158_66e99b80cba8["error-handling.spec.ts"]
  db9e7bef_009d_3918_6e7d_543a36a38d75["vue"]
  5f768e1f_803a_b0bb_2158_66e99b80cba8 --> db9e7bef_009d_3918_6e7d_543a36a38d75
  style 5f768e1f_803a_b0bb_2158_66e99b80cba8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import Vue from 'vue'

const components = createErrorTestComponents()

describe('Error handling', () => {
  // hooks that prevents the component from rendering, but should not
  // break parent component
  ;[
    ['data', 'data()'],
    ['render', 'render'],
    ['beforeCreate', 'beforeCreate hook'],
    ['created', 'created hook'],
    ['beforeMount', 'beforeMount hook'],
    ['directive bind', 'directive foo bind hook'],
    ['event', 'event handler for "e"']
  ].forEach(([type, description]) => {
    it(`should recover from errors in ${type}`, done => {
      const vm = createTestInstance(components[type])
      expect(`Error in ${description}`).toHaveBeenWarned()
      expect(`Error: ${type}`).toHaveBeenWarned()
      assertRootInstanceActive(vm).then(done)
    })
  })

  // hooks that can return rejected promise
  ;[
    ['beforeCreate', 'beforeCreate hook'],
    ['created', 'created hook'],
    ['beforeMount', 'beforeMount hook'],
    ['mounted', 'mounted hook'],
    ['event', 'event handler for "e"']
  ].forEach(([type, description]) => {
    it(`should recover from promise errors in ${type}`, done => {
      createTestInstance(components[`${type}Async`])
      waitForUpdate(() => {
        expect(`Error in ${description} (Promise/async)`).toHaveBeenWarned()
        expect(`Error: ${type}`).toHaveBeenWarned()
      }).then(done)
    })
  })

  // error in mounted hook should affect neither child nor parent
  it('should recover from errors in mounted hook', done => {
    const vm = createTestInstance(components.mounted)
    expect(`Error in mounted hook`).toHaveBeenWarned()
    expect(`Error: mounted`).toHaveBeenWarned()
    assertBothInstancesActive(vm).then(done)
  })

  // error in beforeUpdate/updated should affect neither child nor parent
  ;[
    ['beforeUpdate', 'beforeUpdate hook'],
    ['updated', 'updated hook'],
    ['directive update', 'directive foo update hook']
  ].forEach(([type, description]) => {
    it(`should recover from errors in ${type} hook`, done => {
      const vm = createTestInstance(components[type])
      assertBothInstancesActive(vm)
        .then(() => {
          expect(`Error in ${description}`).toHaveBeenWarned()
// ... (428 more lines)

Domain

Subdomains

Dependencies

  • vue

Frequently Asked Questions

What does error-handling.spec.ts do?
error-handling.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, VDom subdomain.
What functions are defined in error-handling.spec.ts?
error-handling.spec.ts defines 4 function(s): assertBothInstancesActive, assertRootInstanceActive, createErrorTestComponents, createTestInstance.
What does error-handling.spec.ts depend on?
error-handling.spec.ts imports 1 module(s): vue.
Where is error-handling.spec.ts in the architecture?
error-handling.spec.ts is located at test/unit/features/error-handling.spec.ts (domain: VueCore, subdomain: VDom, directory: test/unit/features).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free