pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Fix report template

Open hendzeld opened this issue 1 year ago • 2 comments

Motivation

My colleague had issues with displaying generated reports:

The report was correctly displayed on:

  • my Linux/Firefox machine.
  • his Windows/Edge

The report had no content or even showed blank page on:

  • on his computer windows/firefox
  • on his computer windows/chrome

When I checked the generated report file I noticed that:

  • some tags were not properly closed
  • some special characters are not escaped properly

Issues

Examples

  • https://github.com/pytest-dev/pytest-html/blob/4b714aa558b1f7b8af1035033e4e94601ef75c4b/src/pytest_html/resources/index.jinja2#L32

  • https://github.com/pytest-dev/pytest-html/blob/4b714aa558b1f7b8af1035033e4e94601ef75c4b/src/pytest_html/resources/index.jinja2#L51

Misc

This PR also adds djlint to pre-commit hook.

Changes

Fixed

  • Fixed tags in report template.

Added

  • Added pre-commit hook to validate report template.

hendzeld avatar Apr 04 '24 17:04 hendzeld

Nice!

Thank you for this!

BeyondEvil avatar Apr 05 '24 02:04 BeyondEvil

@BeyondEvil Do we need something more to merge?

hendzeld avatar Apr 24 '24 20:04 hendzeld