(domain, calls, gates)
| 19 | } |
| 20 | |
| 21 | function createAgent(domain, calls, gates) { |
| 22 | const agent = new EventEmitter(); |
| 23 | const method = (name) => async () => { |
| 24 | calls.push(`${domain}.${name}`); |
| 25 | if (domain === 'Runtime' && name === 'runIfWaitingForDebugger') { |
| 26 | const gate = gates.shift(); |
| 27 | if (gate) { |
| 28 | await gate.promise; |
| 29 | } |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | agent.enable = method('enable'); |
| 34 | agent.setSamplingInterval = method('setSamplingInterval'); |
| 35 | agent.setAsyncCallStackDepth = method('setAsyncCallStackDepth'); |
| 36 | agent.setBlackboxPatterns = method('setBlackboxPatterns'); |
| 37 | agent.setPauseOnExceptions = method('setPauseOnExceptions'); |
| 38 | agent.runIfWaitingForDebugger = method('runIfWaitingForDebugger'); |
| 39 | return agent; |
| 40 | } |
| 41 | |
| 42 | function evalCommand(repl, command) { |
| 43 | return new Promise((resolve, reject) => { |
no test coverage detected