Path Fixing
Coverage reports often contain file paths that don’t match your repository structure. This can happen when tests run in different environments (Docker containers, CI runners, different operating systems), when using monorepos or when coverage tools generate absolute paths. Qlty provides path fixing options to resolve these mismatches.
Common Path Issues
Absolute Paths
Coverage tools often generate absolute paths that include the full filesystem path or more than the root relative path:
These should be relative to your repository root:
Container Paths
When running tests in Docker containers, paths often include the container’s working directory:
Missing Path Prefixes
Sometimes coverage reports have paths that are missing required prefixes, particularly in case of monorepos or nested projects:
Path Fixing Options
Strip Prefix
Remove unwanted prefixes from file paths using --strip-prefix
:
GitHub Actions
CLI
Add Prefix
Add required prefixes to file paths using --add-prefix
:
GitHub Actions
Circle CI
CLI
Combining Options
You can use both --strip-prefix
and --add-prefix
together:
Common Scenarios
Docker Containers
Most Docker setups require stripping the container’s working directory:
Monorepos
In monorepos, you may need to add package-specific prefixes:
CI Runners
Different CI providers may generate different path structures:
Verifying Path Fixes
Test with —dry-run
Use dry run to see how paths are being processed:
Validate After Upload
After uploading, check the coverage report in Qlty’s web interface to ensure file paths match your repository structure.
Language-Specific Examples
JavaScript/Node.js
Python
Java
Go
Ruby
Advanced Path Transformations
Multiple Strip Operations
For complex path structures, you may need multiple transformations:
Troubleshooting
No Files Matched
If Qlty reports no files were matched:
- Check that your repository contains the files referenced in the coverage report
- Verify the path transformations result in valid repository paths
- Use debug mode to see the transformed paths
Missing Coverage Data
If some files are missing from the coverage report:
- Confirm all source files are included in the original coverage report
- Check that path transformations don’t accidentally exclude files
- Verify the coverage tool configuration includes all relevant files
See Also
- Running Tests in Docker - Docker-specific path fixing examples
- CI Integration - CI provider-specific path issues
- Coverage Formats - How different formats handle file paths
- Troubleshooting - General coverage upload issues