React testing library can't find 'heading'

Hello all,
I’m having an issue with the aforementioned, no matter what I do, my tests keep failing when I try to get a ‘heading’ element.
I’m getting the following error:
“SyntaxError: ‘*[role~=“heading”],h1,h2,h3,h4,h5,h6’ is not a valid selector”

I have already deleted and recloned the repo, I made sure every library is exactly like Mosh’s and I copy pasted Mosh’s code, and still, I’m getting this error every time I search for a ‘heading’.

I looked in the docs and many examples, every single one is like Mosh’s test.

Please, any suggestions on this?
@Mosh If you have any ideas, please let me know

I see it says invalid selector, try using a different selector for that specific element to be queried

I was able to find the problem, for anyone who might face the same issue, it looks like some dependencies with JSDOM were the cause of the problem, downgrade to jsdom@23.2.0 will fix the problem.

1 Like

Thanks this worked as explained in the video now. I’m curious to know what’s changed between 23.2.0 and 24.0.0 for jsdom that’s causing this error. And if there is anything we should know when writing similar tests.