Automattic / Automattic/expect.js
Allow by-string matching in throwError
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 207
- PR merge metrics
- No merged PRs in 30d
Description
As of today the `throwError` matcher accepts arguments of type being either:
- a regexp
- a function
Personally I find myself quite often matching the error message literally and in this case escaping regexp special chars is a bit of chore. Could we also accept strings as arguments and use the == / === operator to match this string against the error message?
This would definitivelly make my life a bit easier, happy to send a pull request if this meakes sense.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the throwError matcher entry point and review how regexp and function arguments are currently handled. Done means string arguments match the error message literally using the requested equality semantics, with coverage added to the relevant matcher tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100