npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nightwatch-html-reporter-thapovan

v2.0.4

Published

Generates an HTML view of the Nightwatch.js test reports by either parsing the XML files generated by Nightwatch or by using the Nightwatch reporter options.

Downloads

7

Readme

nightwatch-html-reporter

build status npm version npm downloads npm downloads

Generates an HTML view of the Nightwatch.js test reports by either parsing the XML files generated by Nightwatch or by using the Nightwatch reporter options.

Compatibility

In version 0.6.4 Nightwatch changed the format of both the generated XML reports and the object the reporter receives after a test run.

Version 0.3.1 is the last version that supports Nightwatch < 0.6.4

For Nightwatch versions < 0.6.4

npm install [email protected]

For all other versions of Nightwatch

npm install nightwatch-html-reporter

Usage

Using Built in Nightwatch reporter

Requires Nightwatch >= 0.5.32.

/* In nightwatch/globals.js */
var HtmlReporter = require('nightwatch-html-reporter');
var reporter = new HtmlReporter({
	openBrowser: true,
	reportsDirectory: __dirname + '/reports'
});
module.exports = {
	reporter: reporter.fn
};

Using Command Line

Assumes you have installed globally

$ nightwatch-html-reporter -d ~/myProject/tests/nightwatch/reports

Using Nightwatch --reporter option

Create a file beside nightwatch/globals.js that is called something similar to html-reporter.js with the contents

var HtmlReporter = require('nightwatch-html-reporter');
/* Same options as when using the built in nightwatch reporter option */
var reporter = new HtmlReporter({
  openBrowser: true,
  reportsDirectory: __dirname + '/reports/'
});

module.exports = {
  write : function(results, options, done) {
    reporter.fn(results, done);
  }
};

then use the --reporter option like ./nightwatch --reporter ./html-reporter.js

Options

{
	/* True or False.  If true the generated html will be opened
		in your browser after the test run. */
	openBrowser: true,

	/* The directory you've set nightwatch to store your reports.
		On the CLI this determines where we read reports from, but on this
		interface it determines where the generated report will be saved. */
	reportsDirectory: __dirname + '/reports',

	/* The filename that the html report will be saved as. */
	reportFilename: 'generatedReport.html',

	/* Boolean.  If true we ensure the generated report filename
		is unique by appending a timestamp to the end. */
	uniqueFilename: false,

	/* Boolean.  If true we append the last suite name to
		the report filename. */
	separateReportPerSuite: false,

	/* The theme that will be used to generate the html report.
		This should match a directory under the lib/themes directory. */
	themeName: 'default',

	/* If true then only errors will be shown in the report. */
	hideSuccess: false,

	/* If true we append a timestamp to the end of the generated report filename */
	uniqueFilename: false,

	/* If true we convert screenshot paths from absolute paths to relative to output file. */
	relativeScreenshots: false
}

CLI usage

nightwatch-html-reporter -d <reports-directory> [--theme (default:'default')] [--output (default:generatedReport.html)]
Options:
-d, --report-dir            Directory where nightwatch reports are stored. [required]
-t, --theme                 Name of theme to use.  Should match a directory in lib/themes. [default: "default"]
-o, --output                Filename to use when saving the generated report. [default: "generatedReport.html"]
-u, --unique-filename       Appends a timestamp to the end of the generated report filename. [default: false]
-p, --prepend-filename      Prepend filename to the package name in the report.  Helps distinguish between multiple runs/diff browser/same test [default: false]
-r, --relative-screenshots  Convert screenshot paths from absolute to relative to output file. [default: false]
-b, --browser               If true generated report will be opened in the browser. [default: true]
-c, --compact               Hides success cases and only shows error cases.
-l, --log-level             Sets what is logged to the console. 0 - all, 1 - info, 2 - warn, 3 - error [default: 1]
--save-nightwatch-report    Debug: A filename we use to save the report object passed to us by nightwatch.
--save-xml-report           Debug: A filename we use to save the parsed XML object from XML reports.

Available Themes

You can see examples of all of the available themes below. You can also create your own theme by copying an existing theme directory and editing the styles.css file. If you want to also change the structure of the html generated you can edit/copy lib/themes/default/report.pug which contains the markup for the majority of themes.

Theme options that are available on command line and in the options block:

  • default
  • default-gray
  • compact
  • compact-gray
  • cover
  • outlook

Example Reports


Default Theme (default)

ScreenShot


Cover Theme (cover)

ScreenShot

ScreenShot


Compact Theme (compact)

ScreenShot


Default-Gray Theme (default-gray)

ScreenShot


Compact-Gray Theme (compact-gray)

ScreenShot

License

Copyright (c) 2014 James Smith Licensed under the MIT license.