Highlights
Template Coverage - Track branch coverage for your Jinja templates with automatic instrumentation, pytest integration, and multiple report formats.
What's Changed
New Features
- Template Branch Coverage (#4) - Comprehensive coverage tracking for Jinja templates
- Automatic instrumentation of
if/elif/else,forloops, macros, blocks, includes, and ternary expressions - Pytest plugin with CLI options:
--jt-cov,--jt-cov-fail-under,--jt-cov-report,--jt-cov-exclude - Multiple report formats:
term,term-missing,html,json,xml(JUnit) - Configuration via
pyproject.tomlunder[tool.jinjatest.coverage] - New modules:
collector,discovery,instrumenter,tracker,reporter,environment
- Automatic instrumentation of
Improvements
-
Stricter Types with Pydantic (#5) - Enhanced type safety across the codebase
- Added
tytype checker to CI pipeline - Configured type overrides for test files
- Added
-
Updated README (#6) - Streamlined documentation with coverage examples
CI/Build
- Added build hook to generate
_templates.pybefore tests - Added
ty checkto lint workflow - Updated
pyproject.tomlwith coverage plugin entry point
Usage
Enable coverage in your test runs:
pytest --jt-cov --jt-cov-fail-under=80 --jt-cov-report=termOr configure in pyproject.toml:
[tool.jinjatest.coverage]
enabled = true
fail_under = 80
report = ["term", "html"]
exclude_patterns = ["**/vendor/**"]Stats
- 38 files changed
- +6,338 lines / -243 lines
- 11 new coverage module files
- 8 new test files for coverage functionality
Full Changelog
https://github.com/jinjatest/jinjatest/compare/v0.2.0...v0.3.0