Skip to content

Commit d1ba953

Browse files
chore: oops settings.json + skipped tests in summary + getstatusbar fix
1 parent 9c9874a commit d1ba953

File tree

3 files changed

+24
-39
lines changed

3 files changed

+24
-39
lines changed

.vscode/settings.json

+2-29
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,9 @@
11
{
2-
"files.exclude": {
3-
"**/.git": true,
4-
"**/.svn": true,
5-
"**/.hg": true,
6-
"**/CVS": true,
7-
"**/.DS_Store": true,
8-
"**/.vscode-test": true
9-
},
102
"search.exclude": {
11-
"**/out": true
3+
"**/lib": true
124
},
135
"typescript.tsdk": "./node_modules/typescript/lib",
14-
"eslint.workingDirectories": [
15-
"./packages/salesforcedx-apex-replay-debugger",
16-
"./packages/salesforcedx-vscode-visualforce",
17-
"./packages/salesforcedx-vscode-apex-replay-debugger",
18-
"./packages/salesforcedx-vscode-core",
19-
"./packages/salesforcedx-vscode-apex",
20-
"./packages/salesforcedx-utils-vscode",
21-
"./packages/salesforcedx-visualforce-markup-language-server",
22-
"./packages/salesforcedx-visualforce-language-server",
23-
"./@typescript-eslint/no-unsafe-return",
24-
"./packages/salesforcedx-test-utils-vscode",
25-
"./packages/system-tests",
26-
"./packages/salesforcedx-vscode-apex-debugger",
27-
"./packages/salesforcedx-vscode-lwc",
28-
"./packages/salesforcedx-apex-debugger",
29-
"./packages/salesforcedx-vscode-soql",
30-
"./packages/salesforcedx-utils",
31-
"./packages/salesforcedx-vscode-lightning",
32-
"./packages/salesforcedx-sobjects-faux-generator"
33-
],
6+
"eslint.workingDirectories": ["./test"],
347
"editor.tabSize": 2,
358
"editor.insertSpaces": true,
369
"editor.detectIndentation": true,

test/custom-summary-reporter.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { MochaOptions, Runner, Test } from 'mocha';
2-
const { EVENT_RUN_END, EVENT_TEST_PASS, EVENT_TEST_FAIL } = Runner.constants;
2+
const { EVENT_RUN_END, EVENT_TEST_PASS, EVENT_TEST_FAIL, EVENT_TEST_PENDING } = Runner.constants;
33

44
class CustomSummaryReporter {
55
private passes: { title: string; duration: number }[] = [];
66
private failures: { title: string; error: string; duration: number }[] = [];
7+
private pending: { title: string }[] = [];
78

89
constructor(runner: Runner, options?: MochaOptions) {
910
// Listen for passed tests
@@ -23,30 +24,43 @@ class CustomSummaryReporter {
2324
});
2425
});
2526

27+
// Listen for pending (skipped) tests
28+
runner.on(EVENT_TEST_PENDING, (test: Test) => {
29+
this.pending.push({ title: test.title });
30+
});
31+
2632
// When all tests have finished running
2733
runner.once(EVENT_RUN_END, () => {
2834
this.printSummary();
2935
});
3036
}
3137

32-
// Print the summary of passed and failed tests
38+
// Print the summary of passed, failed, and pending tests
3339
private printSummary(): void {
3440
console.log('\nTest Summary:\n');
3541

3642
// Print passed tests
3743
console.log('Passing Tests:\n');
38-
this.passes.forEach((test) => {
44+
this.passes.forEach(test => {
3945
console.log(` ✔ ${test.title} (${test.duration}ms)`);
4046
});
4147

4248
// Print failed tests
4349
if (this.failures.length > 0) {
4450
console.log('\nFailing Tests:\n');
45-
this.failures.forEach((test) => {
51+
this.failures.forEach(test => {
4652
console.log(` ✘ ${test.title} (${test.duration}ms)`);
4753
console.log(` Error: ${test.error}\n`);
4854
});
4955
}
56+
57+
// Print pending tests
58+
if (this.pending.length > 0) {
59+
console.log('Skipped Tests:\n');
60+
this.pending.forEach(test => {
61+
console.log(` ~ ${test.title}`);
62+
});
63+
}
5064
}
5165
}
5266

test/utilities/statusBar.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { WebElement } from 'vscode-extension-tester';
9-
import { Duration, debug, pause } from './miscellaneous';
9+
import { Duration, log, pause } from './miscellaneous';
1010
import { getWorkbench } from './workbench';
1111

1212
export async function getStatusBarItemWhichIncludes(title: string): Promise<WebElement> {
@@ -16,15 +16,13 @@ export async function getStatusBarItemWhichIncludes(title: string): Promise<WebE
1616
const statusBar = await workbench.getStatusBar().wait();
1717
const items = await statusBar.getItems();
1818
for (const item of items) {
19-
const itemTitle = await item.getAttribute('title');
20-
debug(`status bar item title ${itemTitle}`);
21-
if (itemTitle.includes(title)) {
19+
const ariaLabel = await item.getAttribute('aria-label');
20+
if (ariaLabel.includes(title)) {
21+
log('Status Bar item found.');
2222
return item;
2323
}
2424
}
25-
2625
await pause(Duration.seconds(1));
2726
}
28-
2927
throw new Error(`Status bar item containing ${title} was not found`);
3028
}

0 commit comments

Comments
 (0)