component-async.spec.ts — vue Source File
Architecture documentation for component-async.spec.ts, a typescript file in the vue codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ea8e856d_9896_11fe_2b8d_6e01a6e16aef["component-async.spec.ts"] db9e7bef_009d_3918_6e7d_543a36a38d75["vue"] ea8e856d_9896_11fe_2b8d_6e01a6e16aef --> db9e7bef_009d_3918_6e7d_543a36a38d75 style ea8e856d_9896_11fe_2b8d_6e01a6e16aef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import Vue from 'vue'
describe('Component async', () => {
const oldSetTimeout = setTimeout
const oldClearTimeout = clearTimeout
// will contain pending timeouts set during the test iteration
// will contain the id of the timeout as the key, and the millisecond timeout as the value
// this helps to identify the timeout that is still pending
let timeoutsPending = {}
beforeAll(function () {
// @ts-expect-error
global.setTimeout = function (func, delay) {
if (delay >= 1000) {
// skip vitest internal timeouts
return
}
const id = oldSetTimeout(function () {
delete timeoutsPending[id]
func()
}, delay) as any
timeoutsPending[id] = delay
return id
}
global.clearTimeout = function (id) {
oldClearTimeout(id)
delete timeoutsPending[id]
}
})
afterAll(function () {
global.setTimeout = oldSetTimeout
global.clearTimeout = oldClearTimeout
})
beforeEach(() => {
// reset the timeouts for this iteration
timeoutsPending = {}
})
afterEach(() => {
// after the test is complete no timeouts that have been set up during the test should still be active
// compare stringified JSON for better error message containing ID and millisecond timeout
expect(JSON.stringify(timeoutsPending)).toEqual(JSON.stringify({}))
})
it('normal', done => {
const vm = new Vue({
template: '<div><test></test></div>',
components: {
test: resolve => {
setTimeout(() => {
resolve({
template: '<div>hi</div>'
})
// wait for parent update
Vue.nextTick(next)
}, 0)
// ... (396 more lines)
Dependencies
- vue
Source
Frequently Asked Questions
What does component-async.spec.ts do?
component-async.spec.ts is a source file in the vue codebase, written in typescript.
What does component-async.spec.ts depend on?
component-async.spec.ts imports 1 module(s): vue.
Where is component-async.spec.ts in the architecture?
component-async.spec.ts is located at test/unit/features/component/component-async.spec.ts (directory: test/unit/features/component).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free