Skip to content

Commit dca874b

Browse files
committed
fix #520
1 parent 5be3f3c commit dca874b

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/client/unittests/display/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class TestResultDisplay {
6363
this.statusBar.color = foreColor;
6464
this.statusBar.command = constants.Commands.Tests_View_UI;
6565

66-
if (statusText.length === 0){
66+
if (statusText.length === 0) {
6767
vscode.window.showWarningMessage('No tests ran, please check the configuration settings for the tests.');
6868
}
6969
return tests;
@@ -123,9 +123,9 @@ export class TestResultDisplay {
123123
private updateWithDiscoverSuccess(tests: Tests) {
124124
this.clearProgressTicker();
125125
const haveTests = tests && (tests.testFunctions.length > 0);
126-
this.statusBar.text = haveTests ? '$(zap) Run Tests' : 'No Tests';
127-
this.statusBar.tooltip = haveTests ? 'Run Tests' : 'No Tests discovered';
128-
this.statusBar.command = haveTests ? constants.Commands.Tests_View_UI : constants.Commands.Tests_Discover;
126+
this.statusBar.text = '$(zap) Run Tests';
127+
this.statusBar.tooltip = 'Run Tests';
128+
this.statusBar.command = constants.Commands.Tests_View_UI;
129129
this.statusBar.show();
130130

131131
if (!haveTests) {

src/client/unittests/display/picker.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {QuickPickItem, window} from 'vscode';
1+
import { QuickPickItem, window } from 'vscode';
22
import * as vscode from 'vscode';
3-
import {Tests, TestsToRun, TestFolder, TestFile, TestFunction, TestSuite, FlattenedTestFunction, TestStatus} from '../common/contracts';
4-
import {getDiscoveredTests} from '../common/testUtils';
3+
import { Tests, TestFunction, FlattenedTestFunction, TestStatus } from '../common/contracts';
4+
import { getDiscoveredTests } from '../common/testUtils';
55
import * as constants from '../../common/constants';
66
import * as path from 'path';
77

@@ -13,7 +13,7 @@ export class TestDisplay {
1313
if (item === message) {
1414
vscode.commands.executeCommand(constants.Commands.Tests_Stop);
1515
}
16-
})
16+
});
1717
}
1818
public displayTestUI(rootDirectory: string) {
1919
const tests = getDiscoveredTests();
@@ -93,6 +93,9 @@ function getSummary(tests?: Tests) {
9393
function buildItems(rootDirectory: string, tests?: Tests): TestItem[] {
9494
const items: TestItem[] = [];
9595
items.push({ description: '', label: 'Run All Unit Tests', type: Type.RunAll });
96+
if (!tests || tests.testFiles.length === 0){
97+
items.push({ description: '', label: 'Discover Unit Tests', type: Type.ReDiscover });
98+
}
9699
items.push({ description: '', label: 'Run Unit Test Method ...', type: Type.SelectAndRunMethod });
97100

98101
let summary = getSummary(tests);
@@ -114,7 +117,6 @@ statusSortPrefix[TestStatus.Pass] = '4';
114117
function buildItemsForFunctions(rootDirectory: string, tests: FlattenedTestFunction[], sortBasedOnResults: boolean = false, displayStatusIcons: boolean = false): TestItem[] {
115118
let functionItems: TestItem[] = [];
116119
tests.forEach(fn => {
117-
const classPrefix = fn.parentTestSuite ? fn.parentTestSuite.name + '.' : '';
118120
let icon = '';
119121
if (displayStatusIcons && statusIconMapping.has(fn.testFunction.status)) {
120122
icon = `${statusIconMapping.get(fn.testFunction.status)} `;

0 commit comments

Comments
 (0)