Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nodebug/emailer

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodebug/emailer - npm Package Compare versions

Comparing version 0.0.6 to 0.0.9

app/files.js

49

app/emailer.js

@@ -1,7 +0,7 @@

const fs = require('fs')
const { readdirSync } = require('fs')
const nodemailer = require('nodemailer')
const { log } = require('@nodebug/logger')
const config = require('@nodebug/config')('emailer')
const path = require('path')
const { extname } = require('path')
const { directory } = require('./files')
const generateHtmlReport = require('./htmler')

@@ -39,17 +39,18 @@

function attachments() {
let attachmentCount = 0
function getAttachments() {
const files = []
const directoryPath = path.dirname(
path.resolve(config.f.replace('json:', '')),
)
fs.readdirSync(directoryPath).forEach((file) => {
if (path.extname(file) === '.html') {
files.push({
path: `${directoryPath}/${file}`,
})
}
})
// files.push({
// path: `${directoryPath}logs/combined.log`,
// });
if (directory !== undefined) {
readdirSync(directory).forEach((file) => {
if (extname(file) === '.html') {
files.push({
path: `${directory}/${file}`,
})
}
})
// files.push({
// path: `${directory}logs/combined.log`,
// });
}
attachmentCount = files.length
return files

@@ -64,3 +65,3 @@ }

text: body(),
attachments: attachments(),
attachments: getAttachments(),
auth: {

@@ -76,7 +77,14 @@ user: config.user.username,

async function sendEmail(environment) {
my.environment = environment
await generateHtmlReport()
const message = options()
if (config.emailReport === true || config.e === true) {
my.environment = environment
if (attachmentCount <= 0) {
log.info(
`No reports were found in ${directory} to email. Exiting emailer.`,
)
return false
}
const gmailer = transporter(config.user.id, config.user.secret)
gmailer.sendMail(options(), (error, info) => {
gmailer.sendMail(message, (error, info) => {
if (error) {

@@ -89,2 +97,3 @@ throw error

}
return true
}

@@ -91,0 +100,0 @@

const { generate } = require('cucumber-html-reporter')
const { log } = require('@nodebug/logger')
const config = require('@nodebug/config')('emailer')
const { resolve, dirname } = require('path')
const exists = require('fs').existsSync
const jsonfile = require('jsonfile').readFileSync
const { existsSync } = require('fs')
const { readFileSync } = require('jsonfile')
const { directory, report } = require('./files')
const jsonFile = resolve(config.f.replace('json:', ''))
const dirName = dirname(jsonFile)
module.exports = () => {
if (!exists(jsonFile)) {
log.error(`Cucumber report not found at path ${jsonFile}`)
throw new ReferenceError(`Cucumber report not found at path ${jsonFile}`)
if (!existsSync(report)) {
log.info(
`Cucumber report path should be passed using the -f command line argument`,
)
log.info(`Cucumber report not found at path ${report}`)
return false
}

@@ -28,10 +28,10 @@

generate({
return generate({
theme: 'bootstrap',
jsonFile,
output: `${dirName}/${reportName}.html`,
jsonFile: report,
output: `${directory}/${reportName}.html`,
reportSuiteAsScenarios: true,
launchReport: true,
metadata: jsonfile(jsonFile)[0].metadata,
metadata: readFileSync(report)[0].metadata,
})
}
{
"name": "@nodebug/emailer",
"version": "0.0.6",
"version": "0.0.9",
"author": {

@@ -5,0 +5,0 @@ "name": "Node Bug",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc