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

Set terminateDebuggee to false #562

Merged
merged 3 commits into from Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like this change is needed in this code base, because of this: #556

And the fact they have diverged quite a bit because of the strict null checks in core but not here...

};
});
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