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

Please cover reporting incomplete information (from istanbul report) #3324

Open
fvanderveen opened this issue Jan 9, 2025 · 0 comments
Open

Comments

@fvanderveen
Copy link

I found two issues trying to use please cover on a big internal project. I have set up a minimal reproduction repo here: https://github.com/fvanderveen/please-cover-repro

For some background; our main please build step (installing npm dependencies and building our sources) requires many files, more than the (standard) linux command line allows in one command (i.e. using a glob to include all .ts files will fail please). As such, we have a filegroup containing multiple source folders (similar to the single srcs = ["src"] in the repo above).

When running please cover on our tests, we do not get any coverage data, no matter how we format the istanbul report. Diving a bit into the please sources, I found that please attempts to filter the coverage report based on files deduced by non-test dependencies.
This happens in coverage.go using collectCoverageFiles and collectAllFiles. The latter will, however, in our case get a list of folders; which (obviously) does not match the hasCoverageExtension, resulting in a list of coverage files that only includes some of the global setup files but none of the actually covered files. This results in all our actual coverage data being filtered out, and nothing reported.

Using the repo above, trying to display it actually works when using a glob, I found there is actually a second issue in istanbul_coverage.go where sanitiseFileName actually matches the paths against target.TmpDir() successfully first (resulting in the report containing run_1/src/utils.ts and still not matching the collected coverage files). If I move the target.TestDir(run) match above the tmp dir one, it does work as expected.

In our case, it would be preferable if a setup like srcs = ["src"] actually would match and include coverage for anything under the src directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant