Skip to content

Commit e2754e1

Browse files
committed
colorize statusbar based on results microsoft#239
1 parent d842eb6 commit e2754e1

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

  • src/client/unittests/display

src/client/unittests/display/main.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,31 @@ export class TestResultDisplay {
3838
// Treat errors as a special case, as we generally wouldn't have any errors
3939
const statusText = [];
4040
const toolTip = [];
41+
let foreColor = '';
4142

4243
if (tests.summary.passed > 0) {
4344
statusText.push(`${constants.Octicons.Test_Pass} ${tests.summary.passed}`);
4445
toolTip.push(`${tests.summary.passed} Passed`);
46+
foreColor = '#66ff66';
47+
}
48+
if (tests.summary.skipped > 0) {
49+
statusText.push(`${constants.Octicons.Test_Skip} ${tests.summary.skipped}`);
50+
toolTip.push(`${tests.summary.skipped} Skipped`);
51+
foreColor = '#66ff66';
4552
}
4653
if (tests.summary.failures > 0) {
4754
statusText.push(`${constants.Octicons.Test_Fail} ${tests.summary.failures}`);
4855
toolTip.push(`${tests.summary.failures} Failed`);
56+
foreColor = 'yellow';
4957
}
5058
if (tests.summary.errors > 0) {
5159
statusText.push(`${constants.Octicons.Test_Error} ${tests.summary.errors}`);
5260
toolTip.push(`${tests.summary.errors} Error${tests.summary.errors > 1 ? 's' : ''}`);
53-
}
54-
if (tests.summary.skipped > 0) {
55-
statusText.push(`${constants.Octicons.Test_Skip} ${tests.summary.skipped}`);
56-
toolTip.push(`${tests.summary.skipped} Skipped`);
61+
foreColor = 'yellow';
5762
}
5863
this.statusBar.tooltip = toolTip.length === 0 ? 'No Tests Ran' : toolTip.join(', ') + ' (Tests)';
5964
this.statusBar.text = statusText.length === 0 ? 'No Tests Ran' : statusText.join(' ');
65+
this.statusBar.color = foreColor;
6066
this.statusBar.command = constants.Commands.Tests_View_UI;
6167
return tests;
6268
}
@@ -117,7 +123,7 @@ export class TestResultDisplay {
117123
const haveTests = tests && (tests.testFunctions.length > 0);
118124
this.statusBar.text = haveTests ? '$(zap) Run Tests' : 'No Tests';
119125
this.statusBar.tooltip = haveTests ? 'Run Tests' : 'No Tests discovered';
120-
this.statusBar.command = haveTests ? 'python.viewTests' : constants.Commands.Tests_Discover;
126+
this.statusBar.command = haveTests ? constants.Commands.Tests_View_UI : constants.Commands.Tests_Discover;
121127
this.statusBar.show();
122128
}
123129

0 commit comments

Comments
 (0)