inspec/lib/plugins/inspec-reporter-html2
James Stocks d94d56c4b9 Ignore intermittent test teardown error
Occasionally when the `isolated` tests run in CI, this error is seen:

```
inspec-reporter-html2::when run on a basic profile#test_0002_should produce valid HTML:
Errno::ENOENT: No such file or directory @ apply2files - /tmp/temp20200625-1802-2izu7e.html
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1437:in `unlink'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1437:in `block in remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1442:in `platform_support'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:1436:in `remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:775:in `remove_file'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:562:in `block in rm'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:561:in `each'
    /usr/local/lib/ruby/2.6.0/fileutils.rb:561:in `rm'
    lib/plugins/inspec-reporter-html2/test/functional/inspec_reporter_html2_test.rb:9:in `teardown'
```

It should be OK to ignore the failure to delete the test file - the issue doesn't reproduce on laptops, and CI uses clean VMs each time.

Signed-off-by: James Stocks <jstocks@chef.io>
2020-06-26 09:23:21 +01:00
..
lib Fix a bad interaction involving clearing the plugin registry in unit testing 2020-06-18 14:23:54 -04:00
templates Fix JS execution on Internet Explorer by adding MOTW 2020-06-18 14:23:54 -04:00
test Ignore intermittent test teardown error 2020-06-26 09:23:21 +01:00
README.md Copyediting 2020-06-18 14:23:54 -04:00

inspec-reporter-html2 Plugin

An "improved" HTML output reporter specifically for Chef InSpec. Unlike the default html reporter, which is RSpec-based, this reporter knows about Chef InSpec structures like Controls and Profiles, and includes full metadata such as control tags, etc.

To Install This Plugin

This plugin ships with Chef InSpec and requires no installation.

It should appear when you run:

you@machine $ inspec plugin list

How to use this plugin

To generate an HTML report using this plugin and save the output to a file named report.html, run:

you@machine $ inspec exec some_profile --reporter html2:report.html

Note the 2 in the reporter name. If you omit it and run --reporter html instead, you will run the legacy RSpec HTML reporter.

Configuring the Plugin

The html2 reporter requires no configuration to function. However, two options--alternate_css_file and alternate_js_file--are available for customization. The options are set in the JSON-formatted configuration file that Chef InSpec consumes. For details, see our configuration file documentation.

For example:

{
  "version": "1.2",
  "plugins": {
    "inspec-reporter-html2": {
      "alternate_js_file":"/var/www/js/my-javascript.js",
      "alternate_css_file":"/var/www/css/my-style.css"
    }
  }
}

alternate_css_file

Specifies the full path to the location of a CSS file that will be read and inlined into the HTML report. The default CSS will not be included.

alternate_js_file

Specifies the full path to the location of a JavaScript file that will be read and inlined into the HTML report. The default JavaScript will not be included. The JavaScript file should implement at least a pageLoaded() function, which will be called by the onload event of the HTML body element.

Developing This Plugin

This plugin is part of the Chef InSpec source code. While it has its own tests, the general contribution policy is dictated by the Chef InSpec project at https://github.com/inspec/inspec/blob/master/CONTRIBUTING.md