Skip to content
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

feat: adding tests count badge for the testing explorer #182399

Merged

Conversation

iifawzi
Copy link
Contributor

@iifawzi iifawzi commented May 13, 2023

Hi, this PR should resolve [Feature request] Test explorer show failing tests number in the Activity Bar Badge

Screen.Recording.2023-05-13.at.7.28.54.PM.mp4

Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
@iifawzi
Copy link
Contributor Author

iifawzi commented May 13, 2023

@microsoft-github-policy-service agree

Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
@iifawzi
Copy link
Contributor Author

iifawzi commented May 13, 2023

I've added the badgeTooptip, so if all is selected, we just show the number of tests, let me know if you prefer this to be done in a different way.

Screenshot 2023-05-13 at 11 03 28 PM Screenshot 2023-05-13 at 11 03 53 PM

iifawzi and others added 3 commits May 14, 2023 08:19
Co-authored-by: John Murray <johnm@georgejames.com>
Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
@@ -81,8 +82,10 @@ export class TestingExplorerView extends ViewPane {
private filterActionBar = this._register(new MutableDisposable());
private container!: HTMLElement;
private treeHeader!: HTMLElement;
private countSummary!: CountSummary;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't defined at a known point in the lifecycle. I would remove this property and just pass the summary as an argument to renderActivityCount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing the summary as an argument won't make the badge reactive when there's a change in the configurations, that's why I thought about keeping the summary in the property, so whenever the configuration is updated the render method can find the summary.

this._register(onDidChangeTestingCountBadge(this.renderActivityCount, this));

But thinking about it, do we really want to make it that reactive? I mean, if we just need to react only if it went from any type to off, we can pass undefined maybe as an argument to the function and it would work. but if we want to make it totally reactive, like if you run the tests with badge type passed and then changed it to failed, what do you expect? do you expect to see the number updated immediately?

what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, missed that usage. I would then just remove the ! and type it as CountSummary | undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, added a guard check also in the render method, are we fine with that?

@@ -37,6 +38,14 @@ export const enum DefaultGutterClickAction {
ContextMenu = 'contextMenu',
}

export const enum TestingCountBadge {
All = 'all',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of having "all" as an option. The purpose of the badges is to show things that are happening (busy state when committing on SCM), or things that need to be done (unsaved files in the explorer, or extensions that need updating). Tests that exist are neither of these things. The closest analog would be if the explorer showed a badge displaying the number of files in your workspace, which would be rather odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes sense, I totally agree with you

Copy link
Member

@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Good job integrating with existing code. A couple comments.

Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
@connor4312 connor4312 enabled auto-merge (squash) May 15, 2023 20:51
@connor4312 connor4312 merged commit 7fb686d into microsoft:main May 15, 2023
5 checks passed
@iifawzi iifawzi deleted the feat/181094-count-badge-testing-explorer branch May 19, 2023 09:20
@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Test explorer show failing tests number in the Activity Bar Badge
4 participants