Skip to content

Commit

Permalink
feat: Add pending status (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Jan 16, 2020
1 parent e637de0 commit 7cfa0ab
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions resources/media/dark/pending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/media/light/pending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/explorer/testExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export class TestExplorer implements TreeDataProvider<ITestItem>, Disposable {
dark: this._context.asAbsolutePath(path.join('resources', 'media', 'dark', 'running.svg')),
light: this._context.asAbsolutePath(path.join('resources', 'media', 'light', 'running.svg')),
};
case TestStatus.Pending:
return {
dark: this._context.asAbsolutePath(path.join('resources', 'media', 'dark', 'pending.svg')),
light: this._context.asAbsolutePath(path.join('resources', 'media', 'light', 'pending.svg')),
};
default:
break;
}
Expand Down
8 changes: 4 additions & 4 deletions src/runners/baseRunner/BaseRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export abstract class BaseRunner implements ITestRunner {
this.flattenTestIds(test, flattenedTestIds);
}
this.testIds = flattenedTestIds;
this.updateTestResultsToRunning();
this.updateTestResultsToPending();
}

public async run(launchConfiguration: DebugConfiguration): Promise<Set<string>> {
Expand Down Expand Up @@ -103,7 +103,7 @@ export abstract class BaseRunner implements ITestRunner {
for (const id of this.testIds) {
const result: ITestResult | undefined = testResultManager.getResultById(id);
// In case that unexpected errors terminate the execution
if (result && result.status === TestStatus.Running) {
if (result && (result.status === TestStatus.Pending || result.status === TestStatus.Running)) {
result.status = undefined;
testResultManager.storeResult(result);
}
Expand Down Expand Up @@ -188,12 +188,12 @@ export abstract class BaseRunner implements ITestRunner {
throw new Error(`Failed to find path: ${fullPath}`);
}

private updateTestResultsToRunning(): void {
private updateTestResultsToPending(): void {
const runningResults: ITestResult[] = [];
for (const id of this.testIds) {
runningResults.push({
id,
status: TestStatus.Running,
status: TestStatus.Pending,
});
}
testResultManager.storeResult(...runningResults);
Expand Down
2 changes: 1 addition & 1 deletion src/runners/baseRunner/BaseRunnerResultAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export abstract class BaseRunnerResultAnalyzer {
for (const id of this.testIds) {
const result: ITestResult | undefined = testResultManager.getResultById(id);
// In case that unexpected errors terminate the execution
if (result && (!result.status || result.status === TestStatus.Running)) {
if (result && (!result.status || result.status === TestStatus.Pending || result.status === TestStatus.Running)) {
testResultManager.removeResultById(id);
this.testIds.delete(id);
}
Expand Down
2 changes: 2 additions & 0 deletions src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export class JUnitRunnerResultAnalyzer extends BaseRunnerResultAnalyzer {
id: testId,
status: TestStatus.Running,
};
} else if (result.status === TestStatus.Pending) {
result.status = TestStatus.Running;
}
const start: number = Date.now();
if (data.indexOf(MessageId.IGNORE_TEST_PREFIX) > -1) {
Expand Down
1 change: 1 addition & 0 deletions src/runners/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface ITestResult {
}

export enum TestStatus {
Pending = 'Pending',
Running = 'Running',
Pass = 'Pass',
Fail = 'Fail',
Expand Down

0 comments on commit 7cfa0ab

Please sign in to comment.