Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Commit

Permalink
Merge pull request #14 from Financial-Times/correct-suite-name-email
Browse files Browse the repository at this point in the history
Correct suite name in email
  • Loading branch information
ironsidevsquincy authored Sep 20, 2016
2 parents ab70eff + 0414d68 commit 204a66e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ 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" <no-reply@ft.com>',
from: `"Signup ${capitalisedSuite}" <no-reply@ft.com>`,
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 ', '')
};

transporter.sendMail(options, function (emailError, data) {
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);
});
};
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ module.exports = class Automation {

if (error) {
logger.info('Sending email...', error, stderr)
sendEmails(stderr, stdout);
sendEmails(stderr, stdout, { suite });
}
});
}
Expand Down

0 comments on commit 204a66e

Please sign in to comment.