Skip to content

Commit baac9da

Browse files
committed
Updated README.md
1 parent 4655a7f commit baac9da

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,25 +239,34 @@ spec.assert_variables_subset_of({"user_name", "plan", "items"}) # CI guardrails
239239
jinjatest tracks branch coverage by instrumenting your templates at render time. When you use `TemplateSpec`, it automatically discovers all conditional branches (`if`, `elif`, `else`, `for` loops, macros, etc.) and records which paths are executed during tests. This lets you identify untested template logic without modifying your templates.
240240

241241
```bash
242-
pytest --jt-cov --jt-cov-fail-under=80 --jt-cov-report=term
242+
pytest --jt-cov --jt-cov-fail-under=80 --jt-cov-report=term-verbose
243243
```
244244

245245
```
246-
==================== Jinja Template Coverage ====================
247-
Name Branches Covered Missing Cover
248-
------------------------------------------------------------------
249-
templates/welcome.j2 4 3 1 75%
250-
templates/email/confirm.j2 6 6 0 100%
251-
templates/components/nav.j2 8 5 3 62%
252-
------------------------------------------------------------------
253-
TOTAL 18 14 4 78%
246+
======================================================================
247+
JINJA TEMPLATE COVERAGE
248+
======================================================================
249+
250+
Template Branches Covered Coverage
251+
----------------------------------------------------------------------
252+
templates/components/nav.j2 8 5 62.5%
253+
- if_3_false: if condition at line 12 is false
254+
- for_1_empty: for loop at line 18 has no items
255+
- if_5_true: if condition at line 25 is true
256+
templates/email/confirm.j2 6 6 100.0%
257+
templates/welcome.j2 4 3 75.0%
258+
- elif_1: elif branch at line 8 is taken
259+
----------------------------------------------------------------------
260+
TOTAL 18 14 77.8%
261+
262+
FAIL: Coverage 77.8% < required 80.0%
254263
```
255264

256265
| Option | Description |
257266
|--------|-------------|
258267
| `--jt-cov` | Enable template coverage |
259268
| `--jt-cov-fail-under=N` | Fail if coverage below N% |
260-
| `--jt-cov-report=TYPE` | `term`, `term-missing`, `html`, `json`, `xml` |
269+
| `--jt-cov-report=TYPE` | `term`, `term-missing`, `term-verbose`, `html`, `json`, `xml` |
261270
| `--jt-cov-exclude=PATTERN` | Exclude templates by glob |
262271

263272
**pyproject.toml:**

0 commit comments

Comments
 (0)