Releases: SimplifyJobs/jinjatest
Releases · SimplifyJobs/jinjatest
v0.3.0
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
v0.2.0
Added
- New
allow_commentsparameter inparse_json(),RenderedPrompt.as_json(), andRenderedPrompt.as_json_blocks()to support JSON with C-style comments (//and/* */). Useful for JSONC-style configuration files.
Changed
- Simplified instrumentation exports: the
instrument()function has been removed. Instrumentation is now handled internally byTemplateSpec. If you need to add instrumentation to a custom environment, pass it toTemplateSpec.from_file()orTemplateSpec.from_string()via the env parameter. - Comprehensive test coverage for JSON comment parsing
Removed
instrument()function - useTemplateSpecwith a custom env parameter instead
Full Changelog: v0.1.1...v0.2.0
v0.1.1
Fixed
- Fixed TemplateSpec.from_file() not properly loading templates from the filesystem
Changed
- Instrumentation markers (
{#jt:anchor:...#}and{#jt:trace:...#}) now useJinjacomment syntax, rendering as empty strings in production environments. This allowsjinjatestto be a dev-only dependency.
Added
- New
use_comment_markersparameter inTemplateSpec.from_file()andTemplateSpec.from_string()to control comment marker transformation (default:True) instrument()function to add instrumentation to any existingJinjaenvironment- Comprehensive test coverage for markers and basic functionality
Full Changelog: v0.1.0...v0.1.1
v0.1.0
Initial Release
First public release of jinjatest - a type-safe, structured testing library for Jinja templates.
Full Changelog: https://github.com/SimplifyJobs/jinjatest/commits/v0.1.0