This repository has been archived by the owner on Mar 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Financial-Times/correct-suite-name-email
Correct suite name in email
- Loading branch information
Showing
2 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" <[email protected]>', | ||
from: `"Signup ${capitalisedSuite}" <[email protected]>`, | ||
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); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters