Skip to content

Differentiate between regular termination and cancellation #3446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions vscode/src/streamingRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class StreamingRunner implements vscode.Disposable {
linkedCancellationSource.onCancellationRequested(async () => {
this.run!.appendOutput("\r\nTest run cancelled.");
abortController.abort();
await this.finalize();
await this.finalize(true);
});

if (mode === Mode.Run) {
Expand Down Expand Up @@ -248,8 +248,8 @@ export class StreamingRunner implements vscode.Disposable {
return server;
}

private async finalize() {
if (this.currentWorkspace) {
private async finalize(cancellation: boolean) {
if (cancellation && this.currentWorkspace) {
// If the tests are being executed in a terminal, send a CTRL+C signal to stop them
const terminal = this.terminals.get(
`${this.currentWorkspace.workspaceFolder.name}: test`,
Expand Down Expand Up @@ -294,9 +294,8 @@ export class StreamingRunner implements vscode.Disposable {

// Handle the JSON events being emitted by the tests
this.disposables.push(
this.connection.onNotification(
NOTIFICATION_TYPES.finish,
this.finalize.bind(this),
this.connection.onNotification(NOTIFICATION_TYPES.finish, () =>
this.finalize(false),
),
);

Expand Down