Skip to content

Commit

Permalink
return exit code 1 when errors happen
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Aug 9, 2023
1 parent 7258e5b commit 134e4e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,9 @@ let check_npm_deps cli =
l
in
OpamSwitchState.drop st;
()
(* match !error_found with
| false -> ()
| true ->
print_endline "errorrrr";
exit (OpamStd.Sys.get_exit_code `False) *)
match !error_found with
| false -> ()
| true -> exit (OpamStd.Sys.get_exit_code `False)
in
OpamArg.mk_command ~cli OpamArg.cli_original "opam-check-npm-deps" ~doc ~man
Term.(
Expand Down
17 changes: 2 additions & 15 deletions test/main.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ Supports package with more than one depext
Ok: opam package "test.dev" requires npm package: "react-dom" with constraint "^16.0.2", version installed: "16.14.0"
Ok: opam package "test.dev" requires npm package: "react" with constraint "^16.0.2", version installed: "16.14.0"

$ echo $?
0

$ opam pin remove -y test | grep "removed"
-> removed test.dev

Expand Down Expand Up @@ -79,9 +76,6 @@ Supports package one depext, where there is more than one npm package in the sys
Ok: opam package "test.dev" requires npm package: "react" with constraint "^16.0.2", version installed: "16.14.0"
Ok: opam package "test.dev" requires npm package: "react-dom" with constraint "^16.0.2", version installed: "16.14.0"

$ echo $?
0

$ opam pin remove -y test | grep "removed"
-> removed test.dev

Expand Down Expand Up @@ -109,9 +103,6 @@ Errors when using npm-version without an equality filter `=`
$ opam-check-npm-deps
Warning: package test.dev includes an invalid npm-version constraint which does not use equality in its formula: npm-version >= "^16.0.2"

$ echo $?
0

$ opam pin remove -y test | grep "removed"
-> removed test.dev

Expand Down Expand Up @@ -152,9 +143,7 @@ Errors when version does not match
$ opam-check-npm-deps
Error: opam package "test.dev" requires npm package "react-dom" with constraint "^16.0.2", but the version installed is "18.2.0"
Error: opam package "test.dev" requires npm package "react" with constraint "^16.0.2", but the version installed is "18.2.0"

$ echo $?
0
[1]

$ opam pin remove -y test | grep "removed"
-> removed test.dev
Expand Down Expand Up @@ -186,9 +175,7 @@ Errors when node_module folder is not found
$ opam-check-npm-deps
Error: opam package "test.dev" requires npm package "react-dom" with constraint "^16.0.2", but file "$TESTCASE_ROOT/node_modules/react-dom/package.json" can not be found
Error: opam package "test.dev" requires npm package "react" with constraint "^16.0.2", but file "$TESTCASE_ROOT/node_modules/react/package.json" can not be found

$ echo $?
0
[1]

$ opam pin remove -y test | grep "removed"
-> removed test.dev

0 comments on commit 134e4e6

Please sign in to comment.