Skip to content

Commit

Permalink
[update] junit retport timing to use seconds instead of milliseconds (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sarathm09 authored Jun 1, 2020
1 parent 28aa177 commit aa61726
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const dbTransport = async (level, moduleName, jobId, message, error, data) => {
const logData = (transports, moduleName, jobId, level) => async (message, error, data) => {
try {
if (!!jobId && !!message && typeof message === 'object' && !!message.status &&
message.status === '_VIBRANIUM_SESSION_END_' && existsSync(vibPath.jobs)) {
message.status === '_VIBRANIUM_SESSION_END_' && existsSync(vibPath.jobs) && !env.JOB_NAME) {
await writeFile(join(vibPath.jobs, jobId, 'logs.json'), JSON.stringify(logStore.map(l => {
l.jobId = jobId;
return l
Expand Down
15 changes: 8 additions & 7 deletions src/app/loghandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { writeFile, rmdir } = require('fs').promises
const { executionStatus } = require('./constants')
const utils = require('./utils')

let spinner = undefined, cachedFormattedString = {}
let spinner, cachedFormattedString = {}


/**
Expand All @@ -35,8 +35,9 @@ const getAssertLogString = ({ result, test, expected, obtained }) => {
let assertionResponseText = result ? test : `${test}, expected: ${chalk.yellowBright(expected)}, obtained: ${chalk.yellowBright(obtained)}`
if (utils.isMac) {
return result ? chalk.green('✔ ') + assertionResponseText : chalk.red('✖ ') + assertionResponseText
} else {
return result ? assertionResponseText + ': SUCCESS': assertionResponseText + ': FAIL'
}
return assertionResponseText
}


Expand Down Expand Up @@ -476,17 +477,17 @@ const generateJunitReportForScenario = async (scenario) => {
errors: 0,
skipped: endpoints.filter(e => e.ignore),
timestamp: new Date().toISOString(),
time: endpoints.map(e => e._time && e._time.total)
.filter(t => !!t && !isNaN(t)).reduce((a, c) => a + c, 0)
time: (endpoints.map(e => e._time && e._time.total)
.filter(t => !!t && !isNaN(t)).reduce((a, c) => a + c, 0)) / 1000
})

for (const endpoint of endpoints) {
const testCase = testReport.ele('testcase', {
name: endpoint.name,
classname: [scenario.collection, scenario.name, endpoint.name].join('.'),
classname: [scenario.collection, scenario.name].join('.'),
assertions: endpoint._expect ? endpoint._expect.length : 1,
time: endpoint._time ? endpoint._time.total :
endpoint._result.map(res => res.timing.total).reduce((a, c) => a + c, 0)
time: (endpoint._time ? endpoint._time.total :
endpoint._result.map(res => res.timing.total).reduce((a, c) => a + c, 0)) / 1000
})
if (!endpoint._status) {
let endpointResponses = endpoint._result
Expand Down

0 comments on commit aa61726

Please sign in to comment.