Skip to content

Commit

Permalink
[ change ][ ci ] Print detailed error for the test cases for `Connect…
Browse files Browse the repository at this point in the history
…ion.findCommands`
  • Loading branch information
banacorn committed Feb 19, 2025
1 parent 8c97f20 commit 3e67607
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
32 changes: 11 additions & 21 deletions lib/js/src/Connection/Connection__Validation.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions lib/js/test/tests/Test__Connection.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions src/Connection/Connection__Validation.res
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ let run = (path, args, validator: validator<'a>): promise<result<'a, Error.t>> =
} // Check if it's a .bat file
else if String.endsWith(path, ".bat") {
("cmd.exe", ["/c", path, ...args])
} else if String.endsWith(path, ".exe") {
(path, args)
} else {
// append .exe to the path
(path ++ ".exe", args)
(path, args)
}

// reject if the process hasn't responded for more than 20 second
Expand Down
4 changes: 3 additions & 1 deletion test/tests/Test__Connection.res
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ describe("Connection", () => {
let commands = ["agda", "als"]
switch await Connection.findCommands(commands) {
| Ok(_) => ()
| Error(_) => failwith("expected to find `agda` or `als`")
| Error(error) =>
let (header, body) = Connection.Error.toString(error)
failwith("expected to find `agda` or `als`: " ++ header ++ " - " ++ body)
}
},
)
Expand Down

0 comments on commit 3e67607

Please sign in to comment.