-
-
Notifications
You must be signed in to change notification settings - Fork 368
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 created and removed files for diffForFile
, JSONDiffForFile
, JSONPatchForFile
#369
Conversation
aceb5ba
to
5f88511
Compare
This is looking sweeeeeeet 👍 |
expect(empty).toEqual({ | ||
before: null, | ||
after: after, | ||
diff: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orta Would love to get your thoughts here.
For created files, I think it makes sense to have before
return null
since the before
is the absence of the file. The diff
is technically correct to, but feel unexpected and/or inconsistent with other behavior.
What do you think about JSONPatchForFile
returning null
for before
, but the diff
as the result between {}
and after
?
So instead of this:
{
"op": "replace",
"path": "",
"value": {
"a": "o, world",
"b": 3,
"c": ["one", "two", "three", "four"],
}
}
it becomes this:
[
{
"op": "add",
"path": "/a",
"value": "o, world"
},
{
"op": "add",
"path": "/b",
"value": 3
},
{
"op": "add",
"path": "/c",
"value": [
"one",
"two",
"three",
"four"
]
}
]
While not technically correct, I think it makes more sense semantically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree 👍
e8b8999
to
bf06857
Compare
bf06857
to
058528e
Compare
@orta I think this is ready! 👌 |
diffForFile
, JSONDiffForFile
, JSONPatchForFile
diffForFile
, JSONDiffForFile
, JSONPatchForFile
ad7d09b
to
1562db4
Compare
Awesome, amazing and beautifully tested 👍 |
Shipped as Danger 2.0a15 |
Functions
diffForFile
JSONPatchForFile
JSONDiffForFile