microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
test/resources/processExecution/recording.ts
99lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | /* The recording is used by Recorder to store a recording, and by |
| 5 | Simulator to read it and simulate it. |
| 6 | |
| 7 | File order: This file is ordered in a top-down approach */ |
| 8 | |
| 9 | export interface Recording { |
| 10 | /* Metadata */ |
| 11 | title: string; |
| 12 | arguments: ISpawnArguments; |
| 13 | date: Date; |
| 14 | configuration: MachineConfiguration; |
| 15 | state: MachineState; |
| 16 | |
| 17 | /* Recorded events data */ |
| 18 | events: IEventArguments[]; |
| 19 | } |
| 20 | |
| 21 | export interface ISpawnArguments { |
| 22 | command: string; |
| 23 | args: string[]; |
| 24 | options: ISpawnOptions; |
| 25 | } |
| 26 | |
| 27 | export interface ISpawnOptions { |
| 28 | cwd?: string; |
| 29 | stdio?: any; |
| 30 | env?: any; |
| 31 | detached?: boolean; |
| 32 | } |
| 33 | |
| 34 | export interface MachineConfiguration { |
| 35 | os: { platform: string, release: string }; |
| 36 | android: { |
| 37 | sdk: { tools: string, platformTools: string, buildTools: string, repositoryForSupportLibraries: string }; |
| 38 | intelHAXMEmulator: string; |
| 39 | visualStudioEmulator: string; |
| 40 | }; |
| 41 | reactNative: string; |
| 42 | node: string; |
| 43 | npm: string; |
| 44 | } |
| 45 | |
| 46 | export interface MachineState { |
| 47 | reactNative: { packager: PackagerStatus }; |
| 48 | devices: { android: IAndroidDevice[], ios: IIOSDevice[] }; |
| 49 | } |
| 50 | |
| 51 | export type PackagerStatus = "Running" | "NotRunning" | "TBD"; |
| 52 | |
| 53 | export interface IAndroidDevice { |
| 54 | id: string; |
| 55 | type: AndroidDeviceType; |
| 56 | hardware: string; |
| 57 | os: string; |
| 58 | api: number; |
| 59 | otherSpecs: string; |
| 60 | appStatus: AppStatusInDevice; |
| 61 | } |
| 62 | |
| 63 | export type AndroidDeviceType = "SDKEmulator" | "VisualStudioEmulator" | "IntelHAXMEmulator_x86" | "IntelHAXMEmulator_x64" | "PhysicalDevice"; |
| 64 | |
| 65 | export type AppStatusInDevice = "NotInstalled" | "Installed" | "Running" | "Debugging" | "TBD"; |
| 66 | |
| 67 | export interface IIOSDevice { |
| 68 | id: string; |
| 69 | type: IIOSDeviceType; |
| 70 | appStatus: AppStatusInDevice; |
| 71 | } |
| 72 | |
| 73 | export type IIOSDeviceType = "TBD"; |
| 74 | |
| 75 | export type IEventArguments = IStdOutEvent | IStdErrEvent | IErrorEvent | IExitEvent | ICustomEvent; |
| 76 | |
| 77 | export interface ITimedEvent { |
| 78 | after: number; |
| 79 | } |
| 80 | |
| 81 | export interface IStdOutEvent extends ITimedEvent { |
| 82 | stdout: { data: string }; |
| 83 | } |
| 84 | |
| 85 | export interface IStdErrEvent extends ITimedEvent { |
| 86 | stderr: { data: string }; |
| 87 | } |
| 88 | |
| 89 | export interface IErrorEvent extends ITimedEvent { |
| 90 | error: { error: any }; |
| 91 | } |
| 92 | |
| 93 | export interface IExitEvent extends ITimedEvent { |
| 94 | exit: { code: number }; |
| 95 | } |
| 96 | |
| 97 | export interface ICustomEvent extends ITimedEvent { |
| 98 | custom: { lambda: () => Q.Promise<void> | void }; |
| 99 | } |
| 100 | |