The problem is that the regex ends up being (?:) because there are no known scope tokens.
I can't figure out how it's possible for us not to have any known scope tokens, but in any case, it's much more catastraphic to over-replace than to just skip the replacement.
So even in the absence of a reproducible test case, I propose we just skip the replacement for now if there are no known scope tokens.
BREAKING CHANGE: Snapshots may change.
For reasons I don't understand yet, it's possible for us to end up with a serialized DOM like this:
The proximate cause is this code:
https://github.com/salesforce/lwc-test/blob/c78dca8b39c691c8eb9af1b840e84f076449e55b/packages/%40lwc/jest-serializer/src/clean-style-element.js#L11
The problem is that the regex ends up being
(?:)
because there are no known scope tokens.I can't figure out how it's possible for us not to have any known scope tokens, but in any case, it's much more catastraphic to over-replace than to just skip the replacement.
So even in the absence of a reproducible test case, I propose we just skip the replacement for now if there are no known scope tokens.