:has still doesn't work for me in jsdom 25.0.0 for complex selectors. Although, I tried a workaround that worked for me:
I faced issue with
.test-div:not(:has(.special-div))
and I replaced with
.test-div:not(:scope:has(.special-div))