1.0.1 • Published 6 years ago

simple-ava-html-reporter v1.0.1

Weekly downloads
23
License
MIT
Repository
bitbucket
Last release
6 years ago

Simple Ava HTML Reporter

NPM

Simple Ava HTML Reporter is a reporting module for Ava to parse the JSON output to a beautiful report. The difference between all the other reporting modules on the market is that this module has:

  • a quick overview of all tested features and scenarios
  • a test overview that can be searched / filtered / sorted

Install

Install this module locally with the following command:

npm install simple-ava-html-reporter

Save to dependencies or dev-dependencies:

npm install simple-ava-html-reporter --save
npm install simple-ava-html-reporter --save-dev

Usage

It provides simple-ava-html-reporter and some nice integration features that will make using avaJS and tap-json reporter to nicely integrate with only a few lines of code.

const report = require("simple-ava-html-reporter");

report.generate({
  jsonDir: "./test/unit/data/ava/",
  reportPath: "./.tmp/test/",
  reportName: "You can adjust this report name",
  customData: {
    title: "AVA Run info",
    data: [
      { label: "Project", value: "AVA Custom project" },
      { label: "Release", value: "1.2.3" },
      { label: "Cycle", value: "B11221.34321" },
      { label: "Execution Start Time", value: "Apr 19th 2018, 02:31 PM EST" },
      { label: "Execution End Time", value: "Apr 19th 2018, 02:56 PM EST" }
    ]
  }
});

Options

jsonDir

  • Type: String
  • Mandatory: Yes

The directory that will hold all the generated JSON files, relative from where the script is started.

N.B.: If you use a npm script from the command line, like for example npm run generate-report the jsonDir will be relative from the path where the script is executed. Executing it from the root of your project will also search for the jsonDir from the root of you project.

reportPath

  • Type: String
  • Mandatory: Yes

The directory in which the report needs to be saved, relative from where the script is started.

N.B.: If you use a npm script from the command line, like for example npm run generate-report the reportPath will be relative from the path where the script is executed. Executing it from the root of your project will also save the report in the reportPath in the root of you project.

openReportInBrowser

  • Type: boolean
  • Mandatory: No

If true the report will automatically be opened in the default browser of the operating system.

=====================================================================================
    simple Ava HTML report generated in:

    /Users/rahul/simple-ava-html-reporter/.tmp/test/index.html
========================================================================

reportName

  • Type: string
  • Mandatory: No

You can change the report name to a name you want

customData

  • Type: object
  • Mandatory: No

You can add a custom data block to the report like this

customData: {
    title: 'Run info',
    data: [
        {label: 'Project', value: 'Custom project'},
        {label: 'Release', value: '1.2.3'},
        {label: 'Cycle', value: 'B11221.34321'},
        {label: 'Execution Start Time', value: 'Nov 19th 2017, 02:31 PM EST'},
        {label: 'Execution End Time', value: 'Nov 19th 2017, 02:56 PM EST'}
    ]
}

customData.title

  • Type: string
  • Mandatory: No
  • Default: Custom data title

Select a title for the custom data block. If not provided it will be defaulted.

customData.data

  • Type: array
  • Mandatory: yes

The data you want to add. This needs to be in the format

data: [{ label: "your label", value: "the represented value" }];