Git Product home page Git Product logo

jest-markdown-reporter's Introduction

๐Ÿ“œ

jest-markdown-reporter

A Jest test results processor for generating a summary in Markdown.
Forked from jest-html-reporter

Installation

$ npm install --save-dev jest-markdown-reporter

Usage

Configure Jest to process the test results by adding the following entry to the Jest config (jest.config.json):

"reporters": [
	"default",
	["./node_modules/jest-markdown-reporter", {
		"pageTitle": "Test Report"
	}]
]

As you run Jest from within the terminal, a file called test-report.md will be created within your root folder containing information about your tests.

There are multiple configuration options available.

Alternative Usage as a Test Results Processor

To run the reporter as a test results processor (after Jest is complete instead of running in parallel), add the following entry to the Jest config (jest.config.json):

{
	"testResultsProcessor": "./node_modules/jest-markdown-reporter"
}

Note: When running as a testResultsProcessor, the configuration needs be placed within a new file named jestmarkdownreporter.config.json residing in the root folder.

Node Compatibility

This plugin is compatible with Node version ^4.8.3

Configuration

Please note that all configuration properties are optional.

Property Type Description Default
append BOOLEAN If set to true, new test results will be appended to the existing test report false
dateFormat STRING The format in which date/time should be formatted in the test report. "yyyy-mm-dd HH:MM:ss"
executionTimeWarningThreshold NUMBER The threshold for test execution time (in seconds) in each test suite that will render a warning on the report page. 5 seconds is the default timeout in Jest. 5
includeConsoleLog BOOLEAN If set to true, this will output all triggered console logs for each test suite. Please note that you have to run Jest together with --verbose=false in order to have Jest catch any logs during the tests. false
includeFailureMsg BOOLEAN If this setting is set to true, this will output the detailed failure message for each failed test. false
includeSuiteFailure BOOLEAN If set to true, this will output the detailed failure message for complete suite failures. false
includeObsoleteSnapshots BOOLEAN If set to true, this will output obsolete snapshot names. false
logo STRING Path to a logo that will be included in the header of the report null
outputPath STRING The path to where the plugin will output the Markdown report. The path must include the filename and end with .md "./test-report.html"
pageTitle STRING The title of the document. This string will also be outputted on the top of the page. "Test Suite"
sort STRING Sorts the test results using the given method. "default"
statusIgnoreFilter STRING A comma-separated string of the test result statuses that should be ignored when rendering the report. Available statuses are: "passed", "pending", "failed" null

Continuous Integration

Configuration may also be performed with environment variables for dynamic file saving paths in different environments. *NOTE: Environment variables will take precedence over configurations set in jesthtmlreporter.config.json and package.json*

Example

Here is an example of dynamically naming your output file and test report title to match your current branch that one might see in a automated deployment pipeline before running their tests.

export BRANCH_NAME=`git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3`
export JEST_MARKDOWN_REPORTER_OUTPUT_PATH=/home/username/jest-test-output/test-reports/"$BRANCH_NAME".md
export JEST_MARKDOWN_REPORTER_PAGE_TITLE="$BRANCH_NAME"\ Test\ Report

Configuration Environment Variables

The environment variables reflect the configuration options available in JSON format.

jest-markdown-reporter's People

Contributors

cah4a avatar camflan avatar danielhlane avatar dependabot[bot] avatar dtschust avatar elliotboney avatar georgritzmannrtl avatar ghosharnab avatar hargne avatar iansan5653 avatar pascalduez avatar wichopy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.