Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #562 from JohanMabille/disconnect
Browse files Browse the repository at this point in the history
Set terminateDebuggee to false
  • Loading branch information
jtpio committed Nov 19, 2020
2 parents e506604 + 991cba3 commit fe5f759
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/session.ts
Expand Up @@ -128,7 +128,7 @@ export class DebuggerSession implements IDebugger.ISession {
async stop(): Promise<void> {
await this.sendRequest('disconnect', {
restart: false,
terminateDebuggee: true
terminateDebuggee: false
});
this._isStarted = false;
}
Expand Down
13 changes: 11 additions & 2 deletions test/service.spec.ts
Expand Up @@ -173,6 +173,7 @@ describe('DebuggerService', () => {
].join('\n');

let breakpoints: IDebugger.IBreakpoint[];
let sourceBreakpoints: IDebugger.IBreakpoint[];
let sourceId: string;

beforeEach(async () => {
Expand All @@ -190,6 +191,14 @@ describe('DebuggerService', () => {
}
};
});
// create the list of source breakpoints expected from a restore
sourceBreakpoints = breakpoints.map(breakpoint => {
return {
line: breakpoint.line,
verified: breakpoint.verified,
source: breakpoint.source
};
});
await service.updateBreakpoints(code, breakpoints);
});

Expand All @@ -211,7 +220,7 @@ describe('DebuggerService', () => {
expect(bpList1.length).toEqual(0);
await service.restoreState(true);
const bpList2 = model.breakpoints.getBreakpoints(sourceId);
expect(bpList2).toEqual(breakpoints);
expect(bpList2).toEqual(sourceBreakpoints);
});
});

Expand All @@ -226,7 +235,7 @@ describe('DebuggerService', () => {
const bpList = model.breakpoints.getBreakpoints(sourceId);
breakpoints[0].id = 2;
breakpoints[1].id = 3;
expect(bpList).toEqual(breakpoints);
expect(bpList).toEqual(sourceBreakpoints);
});
});

Expand Down
20 changes: 8 additions & 12 deletions test/session.spec.ts
Expand Up @@ -69,7 +69,9 @@ describe('Debugger.Session', () => {
});
await debugSession.start();
await debugSession.stop();
expect(events).toEqual(['output', 'initialized', 'process']);
expect(events).toEqual(
expect.arrayContaining(['output', 'initialized', 'process'])
);
});
});

Expand Down Expand Up @@ -100,7 +102,7 @@ describe('Debugger.Session', () => {
await debugSession.stop();
const { success, message } = reply;
expect(success).toBe(false);
expect(message).toContain('Unable to find thread for evaluation');
expect(message).toBeTruthy();
});
});
});
Expand Down Expand Up @@ -224,8 +226,10 @@ describe('protocol', () => {
frameId
});
const scopes = scopesReply.body.scopes;
expect(scopes.length).toEqual(1);
expect(scopes[0].name).toEqual('Locals');
expect(scopes.length).toBeGreaterThanOrEqual(1);

const locals = scopes.find(scope => scope.name === 'Locals');
expect(locals).toBeTruthy();
});
});

Expand Down Expand Up @@ -294,14 +298,6 @@ describe('protocol', () => {
});
});

describe('#loadedSources', () => {
it('should *not* retrieve the list of loaded sources', async () => {
// `loadedSources` is not supported at the moment "unknown command"
const reply = await debugSession.sendRequest('loadedSources', {});
expect(reply.success).toBe(false);
});
});

describe('#source', () => {
it('should retrieve the source of the dumped code cell', async () => {
const stackFramesReply = await debugSession.sendRequest('stackTrace', {
Expand Down

0 comments on commit fe5f759

Please sign in to comment.