I'm trying to set up my nightwatchjs tests to report to Slack, using the nightwatch-slack-reporter nodejs package.
When I run my nightwatchjs test from the command line, using the following;
npm run test:default /current_functionality/PAR-5139.js --reporter node_modules/nightwatch-slack-reporter/lib/reporter.js
I get the following error;
✖ TypeError: Cannot read property 'slack_webhook_url' of undefined
My globals file looks like this;
var options = {
slack_message: function(results, options) {
return {
text: 'Test completed, passed ' + results.passed + ', failed ' + results.failed,
username: 'Nightwatch',
icon_emoji: ':ghost:'
};
},
slack_webhook_url: 'https://hooks.slack.com/services/................'
};
module.exports = {
reporter: (require('nightwatch-slack-reporter')(options))
};
So firstly, is this anything obviously wrong with my globals setup?
Also, I'm wondering if my webhook url is correct?
I copied and pasted it from my slack app, but is this the right place to get the webhook from, or should I be getting it from the slack instance that the test is reporting to?
Despite this failure, it does actually report the failure to Slack, as below;
but the test is not running/passing.
Any help would be greatly appreciated.
Thanks