New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Html report improvements #30094
Html report improvements #30094
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
|
||
|
@@ -114,6 +120,7 @@ export class Filter { | |
line: String(test.location.line), | ||
column: String(test.location.column), | ||
labels: test.tags.map(tag => tag.toLowerCase()), | ||
annotations: test.annotations.map(a => a.type.toLowerCase() + '=' + a.description?.toLocaleLowerCase()) | ||
}; | ||
(test as any).searchValues = searchValues; | ||
} | ||
|
@@ -144,7 +151,12 @@ 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a test to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have added the test as you suggested . Please review . |
||
} | ||
return true; | ||
} | ||
} | ||
|
@@ -157,5 +169,6 @@ type SearchValues = { | |
line: string; | ||
column: string; | ||
labels: string[]; | ||
annotations: string[]; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will return all the tests w/o annotations as matching the search criteria.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried and it did not . Only test case with annotations will be returned . In below example ,only two test cases which had some annotation is displayed . Am I missing something here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you are right, I missed that
this
is a filter here. Still need a test for every new feature though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the test cases for copy feature . Please review .