I've seen links marked with `role=button` for no reason and generally roles added when one is implied (role=link is implied on anchors for example).
If aria attributes are treated as "private/testing API", then one wouldn't be surprised when the value only makes sense to bots and not humans.
I'd say the ideal scenario is conveying the information that the image conveys. If there is no new information in the image (for example, it might be redundant with the username next to it), it's better to explicitly add an empty alt tag, as far as I'm aware.
Rule of thumb: if someone read the page out to you, would you prefer if they read that alt tag you are thinking of adding or not?
Nothing else works this way. If a page doesn't have a favicon, you don't add an empty icon href.
I know empty alt text is preferred because otherwise, screen readers will usually revert to reading the file name. I wish screen readers didn't do that.
But FWIK it might just be because someone on the standards committee wanted it that way.
You can though — it prevents a 404 error being logged in the browser console.
e.g. <link rel="icon" href="data:,">
In my experience with medium side components it would take seconds to find the element vs a few milliseconds for getByTestId.
I suspect this could be at least partly responsible for the overuse of aria-label. An element can be implemented using "<img aria-label='avatar' src='user.jpg' />" and then tested using "getByRole('img', { name: 'avatar' })". This is technically wrong because getByAltText would be preferable, but it works and it's easy so devs do it.
[1] https://testing-library.com/docs/queries/about#priority