Skip to content

Commit

Permalink
add run failure telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed May 16, 2023
1 parent 51f8ecd commit ec593b6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
31 changes: 18 additions & 13 deletions src/client/testing/testController/pytest/pytestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,19 +285,24 @@ export class PytestController implements ITestFrameworkController {

public runTests(testRun: ITestRun, workspace: WorkspaceFolder, token: CancellationToken): Promise<void> {
const settings = this.configService.getSettings(workspace.uri);
return this.runner.runTests(
testRun,
{
workspaceFolder: workspace.uri,
cwd:
settings.testing.cwd && settings.testing.cwd.length > 0
? settings.testing.cwd
: workspace.uri.fsPath,
token,
args: settings.testing.pytestArgs,
},
this.idToRawData,
);
try {
return this.runner.runTests(
testRun,
{
workspaceFolder: workspace.uri,
cwd:
settings.testing.cwd && settings.testing.cwd.length > 0
? settings.testing.cwd
: workspace.uri.fsPath,
token,
args: settings.testing.pytestArgs,
},
this.idToRawData,
);
} catch (ex) {
sendTelemetryEvent(EventName.UNITTEST_RUN_ALL_FAILED, undefined);
throw new Error(`Failed to run tests: ${ex}`);
}
}
}

Expand Down
33 changes: 19 additions & 14 deletions src/client/testing/testController/unittest/unittestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,25 @@ export class UnittestController implements ITestFrameworkController {
testController?: TestController,
): Promise<void> {
const settings = this.configService.getSettings(workspace.uri);
return this.runner.runTests(
testRun,
{
workspaceFolder: workspace.uri,
cwd:
settings.testing.cwd && settings.testing.cwd.length > 0
? settings.testing.cwd
: workspace.uri.fsPath,
token,
args: settings.testing.unittestArgs,
},
this.idToRawData,
testController,
);
try {
return this.runner.runTests(
testRun,
{
workspaceFolder: workspace.uri,
cwd:
settings.testing.cwd && settings.testing.cwd.length > 0
? settings.testing.cwd
: workspace.uri.fsPath,
token,
args: settings.testing.unittestArgs,
},
this.idToRawData,
testController,
);
} catch (ex) {
sendTelemetryEvent(EventName.UNITTEST_RUN_ALL_FAILED, undefined);
throw new Error(`Failed to run tests: ${ex}`);
}
}
}

Expand Down

0 comments on commit ec593b6

Please sign in to comment.