Last active
December 31, 2023 07:16
-
-
Save dgrebb/cbd4d5271c2cd718923bb6cb06f68766 to your computer and use it in GitHub Desktop.
JSON file diff test for GitHub Actions with property filtering of known dynamic property values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Filter known dynamic timestamped `test`, `testLog`, and `diffImage` properties | |
# Then compare results, and `exit 1` if newly generated report.json is different. | |
diff -q <(jq -S ". | del(.tests[].pair.test, .tests[].pair.testLog, .tests[].pair.diffImage)" test/__fixtures__/sanity-test.json) \ | |
<(jq -S ". | del(.tests[].pair.test, .tests[].pair.testLog, .tests[].pair.diffImage)" test/configs/backstop_data/bitmaps_test/**/report.json) | |
if [[ $? == "0" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment