From 7ecd4c754adb68e20a9601669106e0adab8fa5b9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 7 Apr 2021 17:11:33 +0100 Subject: [PATCH] AHBKM1024A-88 - Compare json files in windows --- differences/json.groovy | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 38b3b40..48c419c 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -1,4 +1,4 @@ -def comparefiles(importedjsonfile, currentjsonfile) { +ddef comparefiles(importedjsonfile, currentjsonfile) { echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}" if (isUnix()) { sh """ @@ -11,30 +11,30 @@ def comparefiles(importedjsonfile, currentjsonfile) { else { // Jq and diffutils can be installed on windows with chocolatey bat """ - echo Checking utilities exist - set - echo %PATH% + REM echo Checking utilities exist + REM set + REM echo %PATH% where jq if errorlevel 1 EXIT /b 1 where diff if errorlevel 1 EXIT /b 1 - echo Sorting json in files to compare + REM echo Sorting json in files to compare REM jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if errorlevel 1 EXIT /b 1 jq -S . "${importedjsonfile}" > temp2.txt if errorlevel 1 EXIT /b 1 - echo Diffing sorted json files + REM echo Diffing sorted json files diff -c temp1.txt temp2.txt set el=%errorlevel% del temp1.txt del temp2.txt - echo Diffing result: %el% - if el GEQ 1 EXIT /b 1 + REM echo Diffing result: %el% + if %el% GEQ 1 EXIT /b 1 """ } }