diff --git a/src/nodeDebugAdapter.ts b/src/nodeDebugAdapter.ts index 5dc1183b..ffff0f80 100644 --- a/src/nodeDebugAdapter.ts +++ b/src/nodeDebugAdapter.ts @@ -197,6 +197,16 @@ export class NodeDebugAdapter extends ChromeDebugAdapter { super.commonArgs(args); } + protected hookConnectionEvents(): void { + super.hookConnectionEvents(); + + this.chrome.Runtime.onExecutionContextDestroyed(params => { + if (params.executionContextId === 1) { + this.terminateSession('Program ended'); + } + }); + } + protected async doAttach(port: number, targetUrl?: string, address?: string, timeout?: number): Promise { await super.doAttach(port, targetUrl, address, timeout); this.beginWaitingForDebuggerPaused(); diff --git a/test/adapter.test.ts b/test/adapter.test.ts index eca7af38..dd428b88 100644 --- a/test/adapter.test.ts +++ b/test/adapter.test.ts @@ -58,8 +58,7 @@ suite('Node Debug Adapter etc', () => { }); suite('launch', () => { - // #11 - test.skip('should run program to the end', () => { + test('should run program to the end', () => { const PROGRAM = path.join(DATA_ROOT, 'program.js'); return Promise.all([