Skip to content

Commit 60127ca

Browse files
committed
awesome: categories ui fixes and subgroups
1 parent d4dea47 commit 60127ca

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

packages/plugin-api/src/utils/tree.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,18 @@ export const createTreeByCategories = <T = TestResult, L = DefaultTreeLeaf, G =
181181
};
182182

183183
export const byCategories = (item: TestResult): string[][] => {
184-
return [item.categories?.map((category: TestResult["categories"]) => category.name) || []];
184+
const categories = item.categories ?? [];
185+
const result: string[][] = [];
186+
187+
for (const category of categories) {
188+
result.push([category.name]);
189+
}
190+
191+
if (item.error?.message) {
192+
result.push([item.error?.message]);
193+
}
194+
195+
return result;
185196
};
186197

187198
/**

packages/plugin-awesome/src/categories.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ export const matchCategories = (
2828

2929
const categoryMatch = (
3030
category: AwesomeCategory,
31-
result: { statusMessage?: string; statusTrace?: string; status: TestStatus; flaky: boolean },
31+
result: { message?: string; trace?: string; status: TestStatus; flaky: boolean },
3232
): boolean => {
33-
const { status, statusMessage, statusTrace, flaky } = result;
33+
const { status, message, trace, flaky } = result;
3434
const matchesStatus =
3535
!category.matchedStatuses || category.matchedStatuses.length === 0 || category.matchedStatuses.includes(status);
36-
const matchesMessage = match(category.messageRegex, statusMessage);
37-
const matchesTrace = match(category.traceRegex, statusTrace);
36+
const matchesMessage = match(category.messageRegex, message);
37+
const matchesTrace = match(category.traceRegex, trace);
3838
const matchesFlaky = (category.flaky ?? flaky) === flaky;
39+
3940
return matchesStatus && matchesMessage && matchesTrace && matchesFlaky;
4041
};
4142

@@ -47,8 +48,7 @@ const match = (regex?: string, value?: string): boolean => {
4748
return false;
4849
}
4950
try {
50-
const b = new RegExp(regex, "s").test(value);
51-
return b;
51+
return new RegExp(regex, "s").test(value);
5252
} catch (ignored) {
5353
return false;
5454
}

0 commit comments

Comments
 (0)