Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coverage #1368

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ setup.log

# Backup of opam lock file
hazel.opam.locked.old

# Code coverage
_coverage/
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,13 @@ test:
watch-test:
dune build @fmt @runtest --auto-promote --watch

coverage:
dune build @src/fmt @test/fmt --auto-promote src test --profile dev
dune runtest --instrument-with bisect_ppx --force
bisect-ppx-report summary

generate-coverage-html:
bisect-ppx-report html

clean:
dune clean
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ You can run all of the unit tests located in `test` by running `make test`.

Unit tests are written using the [Alcotest framework](https://github.com/mirage/alcotest).

#### Coverage
Code coverage is provided by [bisect_ppx](https://github.com/aantron/bisect_ppx). To collect coverage statistics from tests run `make coverage`. After coverage statistics are generated, running `make generate-coverage-html` will generate a local webpage at `_coverage/index.html` that can be viewed to see line coverage per module.

### Continuous Integration

When you push your branch to the main `hazelgrove/hazel` repository, we
Expand Down
4 changes: 3 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
(menhir
(>= 2.0))
yojson
reason
(reason (>= 3.12.0))
ppx_yojson_conv_lib
ppx_yojson_conv
incr_dom
bisect_ppx
(omd (>= 2.0.0~alpha4))
ezjs_idb
bonsai
Expand Down
3 changes: 2 additions & 1 deletion hazel.opam

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

1 change: 1 addition & 0 deletions hazel.opam.locked

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

2 changes: 2 additions & 0 deletions src/haz3lcore/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
(name haz3lcore)
(libraries util sexplib unionFind uuidm virtual_dom yojson core)
(js_of_ocaml)
(instrumentation
(backend bisect_ppx))
(preprocess
(pps
ppx_yojson_conv
Expand Down
4 changes: 4 additions & 0 deletions src/haz3lweb/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
(library
(name workerServer)
(modules WorkerServer)
(instrumentation
(backend bisect_ppx))
(libraries
bonsai
bonsai.web
Expand All @@ -29,6 +31,8 @@

(library
(name haz3lweb)
(instrumentation
(backend bisect_ppx))
(modules
(:standard \ Main)
\
Expand Down
2 changes: 2 additions & 0 deletions src/pretty/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
(library
(name pretty)
(libraries util sexplib)
(instrumentation
(backend bisect_ppx))
(preprocess
(pps ppx_let ppx_sexp_conv)))

Expand Down
2 changes: 2 additions & 0 deletions src/util/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
(name util)
(libraries re base ptmap bonsai bonsai.web virtual_dom yojson)
(js_of_ocaml)
(instrumentation
(backend bisect_ppx))
(preprocess
(pps
ppx_yojson_conv
Expand Down
4 changes: 2 additions & 2 deletions test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(test
(name haz3ltest)
(libraries haz3lcore alcotest junit junit_alcotest)
(libraries haz3lcore alcotest junit junit_alcotest bisect_ppx.runtime)
(modes js)
(preprocess
(pps js_of_ocaml-ppx)))
(pps js_of_ocaml-ppx ppx_deriving.show)))
1 change: 1 addition & 0 deletions test/haz3ltest.re
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ let (suite, _) =
],
);
Junit.to_file(Junit.make([suite]), "junit_tests.xml");
Bisect.Runtime.write_coverage_data();
Loading