-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Labels
🎁 Rewarded on IssuehuntThis issue has been rewarded on IssuehuntThis issue has been rewarded on Issuehuntenhancementhelp wanted
Description
Users should prefer the regex
assertion as it's more readable and gives better output.
Fail
t.true(/\d+/.test(foo()));
Pass
t.regex(foo(), /\d+/);
Same for the negated ones, with t.notRegex
.
Would also be useful to be able to detect the regex from a variable somewhere else in the scope as I often share a regex between multiple asserts:
const re = /\d+/;
…
t.true(re.test(foo()));
This could be auto-fixable, right?
Should we also detect the following?
t.true(foo().search(/\d+/));
t.truthy(foo().match(/\d+/));
IssueHunt Summary
gmartigny has been rewarded.
Sponsors (Total: $60.00)
issuehunt ($60.00)
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Metadata
Metadata
Assignees
Labels
🎁 Rewarded on IssuehuntThis issue has been rewarded on IssuehuntThis issue has been rewarded on Issuehuntenhancementhelp wanted