Skip to content

Commit

Permalink
fix: tests for new Node.js parsers, unify jest configs
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Feb 3, 2024
1 parent 2a026e6 commit b3fbb21
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
rootDir: "./_build/default/",
testMatch: ["**/*_test.js"],
rootDir : "./_build/default/",
testMatch : [ "**/*_test.js" ],
testEnvironment : "node"
};

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"devDependencies": {
"jest": "^26.5.2"
},
"jest": {
"testEnvironment": "node"
}
}
11 changes: 10 additions & 1 deletion src/__tests__/Json_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ let _ =
try
let (_ : Js.Json.t) = parseOrRaise "{" in
fail "should throw"
with ParseError "Unexpected end of JSON input" -> pass));
with
| ParseError "Unexpected end of JSON input"
| ParseError (* Node.js v20 *)
"Expected property name or '}' in JSON at position 1"
| ParseError
(* Node.js v21 *)
"Expected property name or '}' in JSON at position 1 (line 1 \
column 2)"
->
pass));

test "stringify" (fun () -> expect @@ stringify Encode.null |> toEqual "null")

0 comments on commit b3fbb21

Please sign in to comment.