Skip to content

Commit a6cf562

Browse files
authored
run tests only in test runner (#5)
1 parent b240883 commit a6cf562

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/inline_test_ppx.ml

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ let map_struct_item ~found_test struct_item =
1717
match Sys.getenv_opt "INLINE_TEST" with
1818
| Some ("1" | "true") ->
1919
let () = found_test () in
20-
Pstr_eval (expr, [])
20+
let loc = expr.pexp_loc in
21+
Pstr_eval
22+
( [%expr
23+
match [%external process] with
24+
| Some process ->
25+
(match Js.Dict.get process#env "NODE_ENV" with
26+
| Some "test" ->
27+
[%e expr]
28+
| _ ->
29+
())
30+
| None ->
31+
()]
32+
, [] )
2133
| Some _ | None ->
2234
Pstr_eval (nothing struct_item.P.pstr_loc, l)
2335
else

0 commit comments

Comments
 (0)