Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrienjoly/e662374dcf4263bb8d62d4d3474ffada to your computer and use it in GitHub Desktop.
Save adrienjoly/e662374dcf4263bb8d62d4d3474ffada to your computer and use it in GitHub Desktop.
Generate HTML with colors from Jest test results
#!/usr/bin/env bash
# USAGE: ./generate-html-with-colors-from-jest-test-results.sh <file_name>
# => will create:
# - <file_name>.log (with color codes)
# - <file_name>-plain.log (without color codes)
# - <file_name>.html
FILENAME=$1
npm test -- --colors > ${FILENAME}.log
./color-cat ${FILENAME}.log > ${FILENAME}-plain.html
cat ${FILENAME}.log | npx ansi2html-cli > ${FILENAME}.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment