MCPcopy
hub / github.com/vitest-dev/vitest / waitForOrchestrator

Function waitForOrchestrator

packages/browser/src/client/client.ts:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40// ws connection can be established before the orchestrator is fully loaded
41// in very rare cases in the preview provider
42function waitForOrchestrator() {
43 return new Promise<IframeOrchestrator>((resolve, reject) => {
44 const type = getBrowserState().type
45 if (type !== 'orchestrator') {
46 reject(new TypeError('Only orchestrator can create testers.'))
47 return
48 }
49
50 function check() {
51 const orchestrator = getBrowserState().orchestrator
52 if (orchestrator) {
53 return resolve(orchestrator)
54 }
55 setTimeout(check)
56 }
57 check()
58 })
59}
60
61function createClient() {
62 const autoReconnect = true

Callers 2

createTestersFunction · 0.85
cleanupTestersFunction · 0.85

Calls 3

getBrowserStateFunction · 0.90
checkFunction · 0.70
rejectFunction · 0.50

Tested by

no test coverage detected