From 5d15f5be700fdb60e7fb05fc112aa768c474159a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 4 Apr 2023 21:00:35 +0200 Subject: [PATCH 1/2] Use features of find command in test.sh --- tests/bin/test.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/bin/test.sh b/tests/bin/test.sh index 12115d6..dbc0157 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -9,13 +9,18 @@ function validate_schema() { local base=${file//schemas\//} # https://github.com/ajv-validator/ajv-cli/issues/172 - local schemas=$(find schemas -type f -name "*.json" | grep -v "$file") - local rflag="${schemas//$'\n'/ -r }" + local rflags="$(find schemas/ -type f -name "*.json" -not -path "$file" -printf ' -r %P')" local filename=${base/.json/} ls tests/data/$filename/*.json > /dev/null - ./node_modules/.bin/ajv validate --strict --strict-schema=false -c ajv-formats -m tests/hyper-schema/hyper-schema.json -r schema.json -r $rflag -s "$file" -d "tests/data/$filename/*.json" + ./node_modules/.bin/ajv validate --strict --strict-schema=false \ + -c ajv-formats \ + -m tests/hyper-schema/hyper-schema.json \ + -r schema.json \ + $rflags \ + -s "$file" \ + -d "tests/data/$filename/*.json" } IGNORE_FILES=("schemas/rest-api/error.json" "schemas/rest-api/category.json" "schemas/rest-api/tag.json" "schemas/rest-api/page.json") From 2fbaaf43d7d1583d9fa72cff91b621cd518ee599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 4 Apr 2023 21:07:52 +0200 Subject: [PATCH 2/2] Fix printf directive --- tests/bin/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bin/test.sh b/tests/bin/test.sh index dbc0157..031da38 100755 --- a/tests/bin/test.sh +++ b/tests/bin/test.sh @@ -9,7 +9,7 @@ function validate_schema() { local base=${file//schemas\//} # https://github.com/ajv-validator/ajv-cli/issues/172 - local rflags="$(find schemas/ -type f -name "*.json" -not -path "$file" -printf ' -r %P')" + local rflags="$(find schemas/ -type f -name "*.json" -not -path "$file" -printf ' -r %p')" local filename=${base/.json/}