Given the following test code:
const rootComponent = createTestComponent(parent, {
childClassName: 'boo',
})
const testSubComponent = querySelectorDeep('.hello-world .boo', rootComponent);
expect(testSubComponent).toBeNull();
The findMatchingElement will throw the error TypeError: parent.matches is not a function.
This is because it finds the test component matching .boo and traverses up to find a parent that matches .hello-world. As no element matches this selector it'l continue to traverse up until it hits the document element that has no method named matches.