-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
toBeGreaterThan message correction for failing case #7105
Comments
I don't really see the need for this. The behavior is correct as per what the matcher says: i.e |
I agree that the error message seems pretty clear to me, @Abhishek-Modi-Happyperks would you be able to suggest an alternative error message? |
the message should be as in the expected behavior " Expected value to be greater than " but at the current build its giving " Expected " @mattphillips @natealcedo |
You have a point I guess. But then again, the matcher is right above the |
@natealcedo Yes the functions are working properly and it wouldn't be difficult to know. But than at some point one has to figure it out with the stack not with the message. Marked this as Improvement rather than a bug. |
@Abhishek-Modi-Happyperks I’ve just re-read your example and realised I read your solution as the current behaviour 😆 I’m convinced this is a worthwhile change and should just be a one liner to the message output. As @natealcedo said we’d need to also check the other similar matchers to fix them too if they need it. Fancy sending a PR? |
looks like this can be closed based on #7134 |
I'm open the changing something if it's currently unclear, but not by making it inconsistent. That said, I'm not sure what change would improve it. Dimming the frame? Emphasising the matcher in the error? Having a human readable version of all matchers? |
We are working step by step toward two related goals for reports when a matcher fails:
|
@pedrottimark Is there currently a pull request with the initial work started for this? I'd love to help if the plan is to update matchers one by one. |
See #7152 |
@natealcedo Here are pictures of baseline (at left) and improved (at right) report for What took me a while to understand is the ternary expression for
|
Sure! I'll take a look at it over the weekend |
## Summary This pull request updates the failure message returned by toStrictEqual so that it is more inline with what #7105 envisions. ## Test plan The matcher is tested with a snapshot test. Here are a few screenshots of the before and after along with the test file. Before: (I had to minimize the image to fit both tests in one screen) ![image](https://user-images.githubusercontent.com/18214059/47253151-16505300-d482-11e8-9596-a5a37c238d4b.png) After: ![image](https://user-images.githubusercontent.com/18214059/47253131-e012d380-d481-11e8-9211-be3417ec0cd7.png)
I'd love to help by updating one of the other matchers that need to be updated |
@phapp88 You are welcome to update
|
v22.1.2 already have the fix. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Improvement
This bug was
While a case fails for the condition where user expect the result to be greater than certain value , jest reply with the message of expecting a value same as the argument that is passed to function
toBeGreaterThan()
. It should show something more detailed like >0 or min 1 In case of argument value as 0.To Reproduce
Steps to reproduce the behavior:
1 Write the function registerUsername as mentioned:-
2 Write a testcase as mentioned:-
3 Now run the test.
Expected behavior
Behavior On 23.6.0
Link to repl or repo (highly encouraged)
repl.it demo
The Should Work like this link provided but i am getting different result in 23.6.0
Run
npx envinfo --preset jest
Paste the results here:
npx: installed 1 in 2.748s System: OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver) CPU: x64 Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz Binaries: Node: 8.10.0 - /usr/bin/node npm: 6.4.1 - /usr/local/bin/npm
The text was updated successfully, but these errors were encountered: