Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expect-expect] assertFunctionNames - RegEx does not handle functions with numbers in the signature #1103

Closed
EthanPrentice opened this issue May 10, 2022 · 2 comments · Fixed by #1134

Comments

@EthanPrentice
Copy link

EthanPrentice commented May 10, 2022

I have a function with the signature expect404ToBeLoaded() which wasn't matching the wildcard expect* in assertFunctionNames like I thought it should. Looking at the source code it looks like the matching is only done on [a-Z]. Is there a reason for this, or would it make sense to update this to include [0-9]?

function matchesAssertFunctionName(
nodeName: string,
patterns: readonly string[],
): boolean {
return patterns.some(p =>
new RegExp(
`^${p
.split('.')
.map(x => {
if (x === '**') return '[a-z\\.]*';
return x.replace(/\*/gu, '[a-z]*');
})
.join('\\.')}(\\.|$)`,
'ui',
).test(nodeName),
);
}

@G-Rath
Copy link
Collaborator

G-Rath commented May 13, 2022

yup that's a bug

@G-Rath G-Rath changed the title assertFunctionNames - RegEx does not handle functions with numbers in the signature [expect-expect] assertFunctionNames - RegEx does not handle functions with numbers in the signature May 13, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 26.4.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants