Skip to content

Releases: SimplifyJobs/jinjatest

v0.3.0

03 Feb 06:40
4655a7f

Choose a tag to compare

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, for loops, 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.toml under [tool.jinjatest.coverage]
    • New modules: collector, discovery, instrumenter, tracker, reporter, environment

Improvements

  • Stricter Types with Pydantic (#5) - Enhanced type safety across the codebase

    • Added ty type checker to CI pipeline
    • Configured type overrides for test files
  • Updated README (#6) - Streamlined documentation with coverage examples

CI/Build

  • Added build hook to generate _templates.py before tests
  • Added ty check to lint workflow
  • Updated pyproject.toml with coverage plugin entry point

Usage

Enable coverage in your test runs:

pytest --jt-cov --jt-cov-fail-under=80 --jt-cov-report=term

Or 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

23 Jan 01:40
50c6c95

Choose a tag to compare

Added

  • New allow_comments parameter in parse_json(), RenderedPrompt.as_json(), and RenderedPrompt.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 by TemplateSpec. If you need to add instrumentation to a custom environment, pass it to TemplateSpec.from_file() or TemplateSpec.from_string() via the env parameter.
  • Comprehensive test coverage for JSON comment parsing

Removed

  • instrument() function - use TemplateSpec with a custom env parameter instead

Full Changelog: v0.1.1...v0.2.0

v0.1.1

21 Jan 15:28
acb3bac

Choose a tag to compare

Fixed

  • Fixed TemplateSpec.from_file() not properly loading templates from the filesystem

Changed

  • Instrumentation markers ({#jt:anchor:...#} and {#jt:trace:...#}) now use Jinja comment syntax, rendering as empty strings in production environments. This allows jinjatest to be a dev-only dependency.

Added

  • New use_comment_markers parameter in TemplateSpec.from_file() and TemplateSpec.from_string() to control comment marker transformation (default: True)
  • instrument() function to add instrumentation to any existing Jinja environment
  • Comprehensive test coverage for markers and basic functionality

Full Changelog: v0.1.0...v0.1.1

v0.1.0

21 Jan 15:24
4a441b6

Choose a tag to compare

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