diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7f2085..9354f96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,16 +31,16 @@ jobs: node-version: [14.x, 16.x, 18.x] opa-version: - 0.30.2 # last version with ABI 1.1, 0.31.0+ has ABI 1.2 - - 0.41.0 # 0.35.0 is the first release with https://github.com/open-policy-agent/opa/pull/4055 + - 0.45.0 # 0.35.0 is the first release with https://github.com/open-policy-agent/opa/pull/4055 steps: - uses: actions/checkout@v3 - - name: Checkout OPA v${{ matrix.opa-version }} + - name: Checkout OPA v0.45.0 testcases uses: actions/checkout@v3 with: repository: open-policy-agent/opa - ref: v${{ matrix.opa-version }} + ref: v0.45.0 path: opa - run: mkdir test/cases diff --git a/package.json b/package.json index 586e4df..5692fe5 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "lint": "git ls-files | xargs deno lint", "fmt:check": "git ls-files | xargs deno fmt --check", "fmt": "git ls-files | xargs deno fmt", - "test": "jest --verbose" + "test": "jest" }, "repository": { "type": "git", diff --git a/src/builtins/json.js b/src/builtins/json.js index 74acc75..df63490 100644 --- a/src/builtins/json.js +++ b/src/builtins/json.js @@ -1,6 +1,6 @@ function isValidJSON(str) { if (typeof str !== "string") { - return; + return false; } try { JSON.parse(str); diff --git a/src/builtins/yaml.js b/src/builtins/yaml.js index e12f1e3..beb5d1b 100644 --- a/src/builtins/yaml.js +++ b/src/builtins/yaml.js @@ -30,9 +30,8 @@ function parse(str) { } module.exports = { - // is_valid is expected to return nothing if input is invalid otherwise - // true/false for it being valid YAML. - "yaml.is_valid": (str) => typeof str === "string" ? parse(str).ok : undefined, + // is_valid is expected to return false if input is invalid; and true/false for it being valid YAML. + "yaml.is_valid": (str) => typeof str === "string" && parse(str).ok, "yaml.marshal": (data) => yaml.stringify(data), "yaml.unmarshal": (str) => parse(str).result, };