2.4.1 • Published 3 years ago

htmlreport4jest v2.4.1

Weekly downloads
104
License
ISC
Repository
github
Last release
3 years ago

Jest Html Reporter

build npm version downloads/month install size semantic-release

Jest reporter to generate hierarchical html report

Installation


Install with npm

  npm install htmlreport4jest --save-dev

Install with yarn

  yarn add htmlreport4jest --dev

Usage


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

"jest": {
  ...,
  "reporters": [
    "default",
    "htmlreport4jest"
  ],
  ...
}

Executing the jest tests with above configuration will create a result.html under temp folder inside the project root. Test report can be configured with below options.

Available Options

The options below are specific to the reporter.

Option NameTypeDefaultDescription
titlestring'Jest Html Report'Title of the generated html report
reportPathstring'./temp/'Generated html file will be stored under the given path
reportFileNamestring'result.html'Name of the html report to be generated
hideMenuboolenfalseHides filter menu
expandResultsboolenfalseExpand result tabs in report
expandMenuItemsboolenfalseExpand menu nodes in menu
informationarrayDisplays information in the report. Information should be in below format. [{title:"Environment",value:"CI",type:"string"}]. Allowed values for type are given

Allowed Types

Data types allowed for information. | Type | Example | Description | | :---------------- | :----- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | string | "CI" | Will display the text passed | | date | new Date() | Date object or timestamp can be passed. All date will be formated as dd-MMM-yyyy | | datetime | new Date() | Date object or timestamp can be passed. All datetime will be formated as dd-MMM-yyyy hh:mm:ss | | time | 1234 | timestamp can be passed.| | boolean | true or false | true will be displayed as "Yes" and false will be displayed as "No".|

example add config options

...,
"reporters": [
  "default",
  ["htmlreport4jest", {
    "title": 'Jest Html Report',
    "hideMenu": true,
    "information": [{ title: 'Environment', value: 'CI', type: 'string' }]
  }]
]

Sample report

Sample report

2.4.1

3 years ago

2.4.0

3 years ago

2.3.2

3 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.3.0

4 years ago