Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

jobteaser/nightwatch-slack-reporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nightwatch-slack-reporter

Travis CI npm

A Nightwatch.js reporter that notifies results to Slack

Install

npm install --save-dev nightwatch-slack-reporter

Usage

Using Built in Nightwatch reporter

// globals.js
module.exports = {
  reporter: (require('nightwatch-slack-reporter')(options))
}

Using Command Line Options

nightwatch --reporter node_modules/nightwatch-slack-reporter/lib/reporter.js

Options

You can configure Slack reporter options in test globals or configuration file.

options = {
  slack_message: function(results, options) { // function or message string
    return {
      text: 'Test completed, passed ' + results.passed + ', failed ' + results.failed,
      username: 'Nightwatch',
      icon_emoji: ':ghost:'
    } // Message payload or string
  },
  slack_webhook_url: 'https://hooks.slack.com/services/...'
  // This can be specified with SLACK_WEBHOOK_URL environment variable
  additionalFields: [
    'customFieldPathFromNightwatchConfig',
    'anotherCustomFieldPathFromNightwatchConfig'
  ],
  // additionalFields to get from configuration
}

Note that you could access additionalFields from options.additionalFields['customFieldPathFromNightwatchConfig'] into `slack_message function.

Author

Atsushi Nagase

License

MIT License