aantron / bisect_ppx

Code coverage for OCaml and ReScript
http://aantron.github.io/bisect_ppx/demo/
MIT License
302 stars 60 forks source link

Better error message on missing files #386

Closed vch9 closed 3 years ago

vch9 commented 3 years ago

In our project, we have several targets such as (targets: foo.ml), which are a bunch of include. However, these files only exist in _build/, in my specific case when calling:

$ bisect-ppx-report cobertura --coverage-path ${COVERAGE_OUTPUT} ${COBERTURA_REPORT}

I end up having a:

bisect-ppx-report: internal error, uncaught exception:
                   Sys_error("src/[...]/foo.ml: No such file or directory")

I don't really know how files are handled in the tool, would there be a convenient way to handle the targeted files? Alternatively, could we catch No such file or directory and ignore them? Do you know a scenario where ignoring these last is a really bad idea?

vch9 commented 3 years ago

A temporary fix can be --ignore-missing-files

aantron commented 3 years ago

I've reopened the issue, because I think the reporter should have a more helpful error message, that doesn't mention uncaught exceptions, and suggests --ignore-missing-files.

aantron commented 3 years ago

The error message now looks like

Error: cannot find source file 'test.ml' in:
  - .
  - ./_build/default
Hint: consider passing --ignore-missing-files.

Thanks for bringing this up.

vch9 commented 2 years ago

This look way better, thanks :)