-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathindex.d.ts
67 lines (61 loc) · 2.09 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/// <reference path="../driver/types/internal-types-lite.d.ts" />
import type { SocketShape } from '@packages/socket/lib/types'
import type MobX from 'mobx'
import type { EventManager } from './src/runner/event-manager'
export {}
/**
* The eventManager and driver are bundled separately
* by webpack. We cannot import them because of
* circular dependencies.
* To work around this, we build the driver, eventManager
* and some other dependencies using webpack, and consumed the dist'd
* source code.
*
* This is attached to `window` under the `UnifiedRunner` namespace.
*
* For now, just declare the types that we need to give us type safety where possible.
* Eventually, we should decouple the event manager and import it directly.
*/
declare global {
interface Window {
ws?: SocketShape
getEventManager: () => EventManager
UnifiedRunner: {
/**
* This is the config served from the back-end.
* We will manage config using GraphQL going forward,
* but for now we are also caching it on `window`
* to be able to move fast and iterate
*/
config: Record<string, any>
/**
* To ensure we are only a single copy of React
* We get a reference to the copy of React (and React DOM)
* that is used in the Reporter and Driver, which are bundled with
* webpack.
*
* Unfortunately, attempting to have React in a project
* using Vue causes mad conflicts because React'S JSX type
* is ambient, so we cannot actually type it.
*/
React: any
ReactDOM: any
dom: any
highlight: any
CypressJQuery: any
MobX: typeof MobX
/**
* Any React components or general code needed from
* runner, reporter or driver are also bundled with
* webpack and made available via the window.UnifedRunner namespace.
*
* We cannot import the correct types, because this causes the linter and type
* checker to run on runner and reporter, and it blows up.
*/
Reporter: any
shortcuts: {
stop: () => void
}
}
}
}