From fac51e5b37c4a71ac2beeccbe3e55e270dc29045 Mon Sep 17 00:00:00 2001 From: David Sancho Date: Mon, 14 Sep 2020 12:27:10 +0200 Subject: [PATCH] fix: Run e2e without colors --- bin/Info.re | 2 +- e2e/test.sh | 20 +++++++++++++++----- esy.json | 2 +- source/Json.re | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/bin/Info.re b/bin/Info.re index c447a8e..42040a7 100644 --- a/bin/Info.re +++ b/bin/Info.re @@ -1,4 +1,4 @@ -let version = "0.3.4"; +let version = "0.3.5"; let description = "query-json is a faster and simpler re-implementation of jq in Reason Native, available under 'q'"; let repo = "https://github.com/davesnx/query-json"; diff --git a/e2e/test.sh b/e2e/test.sh index 317a729..0b7c6e1 100755 --- a/e2e/test.sh +++ b/e2e/test.sh @@ -5,25 +5,35 @@ function q () { echo "Running in CI mode" run ./q "$@" else - chmod +x "$BATS_TEST_DIRNAME/../_build/default/bin/q.exe" - run "$BATS_TEST_DIRNAME/../_build/default/bin/q.exe" "$@" + chmod +x _build/default/bin/q.exe + run "_build/default/bin/q.exe" "$@" fi } @test "json call works ok" { - q '.first.name' $BATS_TEST_DIRNAME/mock.json + q --no-color '.first.name' e2e/mock.json [ "$status" -eq 0 ] [ "$output" = '"John Doe"' ] } @test "inline call works ok" { - q --kind="inline" '.' '{ "a": 1 }' + q --kind="inline" --no-color '.' '{ "a": 1 }' [ "$status" -eq 0 ] [ "$output" = '{ "a": 1 }' ] } @test "non defined field gives back null" { - q '.wat?' $BATS_TEST_DIRNAME/mock.json + q --no-color '.wat?' e2e/mock.json [ "$status" -eq 0 ] [ "$output" = "null" ] +} + +teardown () { + echo "$BATS_TEST_NAME + +-------- +$output +-------- + +" } \ No newline at end of file diff --git a/esy.json b/esy.json index c58403f..e00cd8b 100644 --- a/esy.json +++ b/esy.json @@ -1,6 +1,6 @@ { "name": "@davesnx/query-json", - "version": "0.3.4", + "version": "0.3.5", "description": "faster and simpler re-implementation of jq in Reason Native", "author": "davesnx ", "license": "MIT", diff --git a/source/Json.re b/source/Json.re index b0a5bff..efb250a 100644 --- a/source/Json.re +++ b/source/Json.re @@ -22,7 +22,7 @@ let (pp_print_string, pp_print_bool, pp_print_list, fprintf, asprintf) = */ let parseFile = Yojson.Basic.from_file; -let parseString = Yojson.Basic.from_file; +let parseString = Yojson.Basic.from_string; let string = str => { let buf = Buffer.create(String.length(str) * 5 / 4);