(mode: ExecutionMode)
| 121 | } |
| 122 | |
| 123 | async setExecutionMode(mode: ExecutionMode) { |
| 124 | if (this.currentRun) { |
| 125 | throw new Error("Wait for the current run to finish before switching execution mode.") |
| 126 | } |
| 127 | |
| 128 | if (this.mode === mode) { |
| 129 | return |
| 130 | } |
| 131 | |
| 132 | const previousMode = this.mode |
| 133 | this.mode = mode |
| 134 | |
| 135 | try { |
| 136 | await this.replaceAgent() |
| 137 | } catch (error) { |
| 138 | this.mode = previousMode |
| 139 | throw error |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | async dispose() { |
| 144 | await this.agent[Symbol.asyncDispose]() |
no test coverage detected