Skip to content

Commit

Permalink
run tests only in test runner (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsnobip authored Jan 10, 2022
1 parent b240883 commit a6cf562
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/inline_test_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ let map_struct_item ~found_test struct_item =
match Sys.getenv_opt "INLINE_TEST" with
| Some ("1" | "true") ->
let () = found_test () in
Pstr_eval (expr, [])
let loc = expr.pexp_loc in
Pstr_eval
( [%expr
match [%external process] with
| Some process ->
(match Js.Dict.get process#env "NODE_ENV" with
| Some "test" ->
[%e expr]
| _ ->
())
| None ->
()]
, [] )
| Some _ | None ->
Pstr_eval (nothing struct_item.P.pstr_loc, l)
else
Expand Down

0 comments on commit a6cf562

Please sign in to comment.