Filter test case in report by annotations
This commit is contained in:
parent
af46dbef53
commit
c3ff7722a3
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
|
||||
import type { TestCaseSummary } from './types';
|
||||
|
||||
export class Filter {
|
||||
project: string[] = [];
|
||||
status: string[] = [];
|
||||
text: string[] = [];
|
||||
labels: string[] = [];
|
||||
annotations: string[] = [];
|
||||
|
||||
empty(): boolean {
|
||||
return this.project.length + this.status.length + this.text.length === 0;
|
||||
|
|
@ -32,6 +32,7 @@ export class Filter {
|
|||
const status = new Set<string>();
|
||||
const text: string[] = [];
|
||||
const labels = new Set<string>();
|
||||
const annotations = new Set<string>();
|
||||
for (const token of tokens) {
|
||||
if (token.startsWith('p:')) {
|
||||
project.add(token.slice(2));
|
||||
|
|
@ -45,6 +46,10 @@ export class Filter {
|
|||
labels.add(token);
|
||||
continue;
|
||||
}
|
||||
if (token.startsWith('a:')) {
|
||||
annotations.add(token.slice(2));
|
||||
continue;
|
||||
}
|
||||
text.push(token.toLowerCase());
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +58,7 @@ export class Filter {
|
|||
filter.project = [...project];
|
||||
filter.status = [...status];
|
||||
filter.labels = [...labels];
|
||||
filter.annotations = [...annotations];
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +133,14 @@ export class Filter {
|
|||
if (!matches)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.annotations.length) {
|
||||
const matches = this.annotations.every(annotation =>
|
||||
searchValues.annotations.some(_annotation => (
|
||||
_annotation.includes(annotation)
|
||||
)));
|
||||
if (!matches)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -140,6 +153,7 @@ type SearchValues = {
|
|||
line: string;
|
||||
column: string;
|
||||
labels: string[];
|
||||
annotations: string[];
|
||||
};
|
||||
|
||||
const searchValuesSymbol = Symbol('searchValues');
|
||||
|
|
|
|||
Loading…
Reference in a new issue