(vm: QuickJSContext, code: string, filename: string)
| 412 | }; |
| 413 | |
| 414 | const evalOrThrow = (vm: QuickJSContext, code: string, filename: string): void => { |
| 415 | const result = vm.evalCode(code, filename); |
| 416 | if (result.error) { |
| 417 | const errData = vm.dump(result.error); |
| 418 | result.error.dispose(); |
| 419 | throw toError(errData); |
| 420 | } |
| 421 | if ('value' in result) { |
| 422 | result.value.dispose(); |
| 423 | } |
| 424 | }; |
| 425 | |
| 426 | /** Drives `globalThis.__task` (a VM promise wrapping the user script) to completion. */ |
| 427 | const driveTaskToCompletion = async (vm: QuickJSContext, deadline: number, timeoutMs: number): Promise<void> => { |
no test coverage detected