From 0414d680b1ac48df0b4db5c57d24d8a591630caf Mon Sep 17 00:00:00 2001 From: Darren Hurley Date: Tue, 20 Sep 2016 10:28:10 +0100 Subject: [PATCH] Correct suite name in email --- src/email.js | 10 +++++----- src/main.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/email.js b/src/email.js index ef3a5ee..b3e0084 100644 --- a/src/email.js +++ b/src/email.js @@ -5,12 +5,12 @@ const nodemailer = require('nodemailer'); const transporter = nodemailer.createTransport(REGRESSION_TRANSPORT); const logger = require('@financial-times/n-logger').default.logger; -module.exports = function sendEmails (err, output) { - +module.exports = function sendEmails (err, output, { suite = 'regression' } = { }) { + const capitalisedSuite = suite.charAt(0).toUpperCase() + suite.slice(1); const options = { - from: '"Signup Regression" ', + from: `"Signup ${capitalisedSuite}" `, to: RECIPIENTS, - subject: `❗Regression tests failed ${new Date()}`, + subject: `❗${capitalisedSuite} tests failed ${new Date()}`, text: output.replace('[0;37m ','').replace('[41m ', '').replace('[42m ', '').replace('[44m ', '').replace('[45m ', '') }; @@ -18,6 +18,6 @@ module.exports = function sendEmails (err, output) { if (emailError) { return logger.info('Error sending emails', emailError); } - logger.info('Regression test notification sent to: ', data); + logger.info(`${capitalisedSuite} test notification sent to: `, data); }); }; diff --git a/src/main.js b/src/main.js index 3f44144..cb41c4f 100644 --- a/src/main.js +++ b/src/main.js @@ -129,7 +129,7 @@ module.exports = class Automation { if (error) { logger.info('Sending email...', error, stderr) - sendEmails(stderr, stdout); + sendEmails(stderr, stdout, { suite }); } }); }