-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
First parameter for "snapshot" assertion should be called "value" for consistency #2931
Comments
Sure, could change that. To |
I prefer "actual "and "expected" as this project uses in the TypeScript declaration file: Line 184 in 6b63b1b
However, this project seems to use the terms "value" and "expected" in the documentation as I link to here. That is an inconsistency which should probably also be addressed. If you need me to open another issue for that, I can. However using the name "expected" with the "snapshot" assertion is backwards and misleading and therefore seems more urgent. |
Here's an issue for the documentation vs. declaration mismatch: #2938 |
Sounds good to me. Would you like to open a PR @DavidAnson? |
Please don't wait for me to send a PR, it's unlikely I'll have time for this soon. |
Looks like |
Please correct me if I'm wrong: When running tests (common scenario), the input to the snapshot function is the actual value observed when running the test. The snapshot function then reads the snapshot file to determine the expected value for that test and diffs the two values. The situation is different when running in |
I got that one backwards. I also don't use snapshots. |
Looking at this now I agree |
Currently, it is called "expected": https://github.com/avajs/ava/blob/main/docs/03-assertions.md#snapshotexpected-message
However, that is inconsistent with other assertion APIs like "is" where parameters are named "value" and "expected": https://github.com/avajs/ava/blob/main/docs/03-assertions.md#isvalue-expected-message
In the case of "snapshot", the expected data is represented by the previously-captured snapshot and the test data (often called "actual") is what gets passed to the function via the first parameter.
The text was updated successfully, but these errors were encountered: