-
Notifications
You must be signed in to change notification settings - Fork 213
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
Include actual/expected values in error events #2123
Comments
I think the diff view will definitely help with |
I don't know, but it's worth noting that the API only accepts strings, so whatever we have we need to stringify it and it'll get a text diff.
It shows up in the Debug Console - but it doesn't appear elsewhere. However I feel like this is a VS Code bug (because it forces us to provide a message that isn't shown - the Debug Console output is from another source). I'll file an issue about that. Edit: Actually it is visible in the title of the peek pane, but it won't handle long values. I've filed microsoft/vscode#195920. |
We would need to figure out some way to identify when it will be useful to do this. In many cases our "Expected:" and "Actual:" lines are too unrelated for a diff to mean anything. For example, with expect(Future.value('sad'), completion(equals('happy'))); Output:
What I think we'd ideally want is to somehow plumb through the 'happy' and 'sad' strings, and then maybe have this full output as the extra context message (assuming the linked vscode issue is resolved). I don't know how difficult it may be to get In await check(Future.value('sad')).completes((r) => r.equals('happy')); Output:
In the the Maybe it's only the string equality case where the extra diff is useful? Deep collection equality could produce a useful diff, but only if we override the tostring output and format collections without any eliding any elements. |
In some of the examples above it says "which differs at offset x". Perhaps all cases that currently build a string like that would be useful (even if they're not exactly a string equality at the top)? (and maybe there are some related ones like "has extra trailing characters"?). |
VS Code runs test with
-r json
and uses the data to populate its test runner. The API allows us to provide expected/actual values for a test failure which can be rendered as a diff:This could be more convenient for some operations (such as copy/pasting the raw
expected
value), but it requires that we have these values in the JSON payloads in their raw form (not embedded in some string).The text was updated successfully, but these errors were encountered: