Skip to content

Updated Pester Problem Matcher #1362

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

Merged
merged 3 commits into from
Jun 12, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"severity": "error",
"pattern": [
{
"regexp": "^\\s*(\\[-\\]\\s*.*?)(\\d+)ms\\s*$",
"regexp": "^\\s*(?:\\[-\\]\\s)(\\s*.*?)(?:\\s\\d*\\.?\\d*s|\\s\\d*\\.?\\d*ms)\\s*$",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could simplify this a bit to:

"^\\s*(?:\\[-\\]\\s+)(.*?)(?:\\s+\\d+\\.?\\d*\\s*m?s)\\s*$"

I don't think we want to include any spaces at the beginning of the message (capture group 1), best to have the first non-capture group scoop up all the spaces after the [-]. Ditto with the second non-capture group - let's have it scoop up all the space at the end of the message.

Also, shouldn't we expect at least one digit (\d+) before the required s or ms? Finally, how about we add a \s* between the time and the units in case they ever decide that the display looks better with a space in there. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. Great feedback. I'm not great with regular expressions (said everyone on the internet), so your write up was a great learning experience for me. I'll get it updated.

"message": 1
},
{
Expand Down