Skip to content

Commit

Permalink
Fix handling of the project name (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fgerthoffert authored Nov 27, 2024
1 parent b0540a6 commit 2fcf6a6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/commands/zencrepes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ class JahiaTestrailReporter extends Command {

// If dependencies were previously fetched, use those for the module
let dependencies = JSON.parse(flags.dependencies)
let name = flags.name
let name = ''
let version = flags.version
let jahiaFullVersion = ''
let jahiaVersion = ''
let moduleVersion = ''
if (flags.moduleFilepath !== undefined) {
const versionFile: any = fs.readFileSync(flags.moduleFilepath)
const versions: UtilsVersions = JSON.parse(versionFile)
if (versions.jahia.fullVersion !== '') {
jahiaFullVersion = versions.jahia.fullVersion
if (versions.jahia.version !== '') {
jahiaVersion = `Jahia ${versions.jahia.version}`
}
if (versions.module.id !== '' && versions.module.version !== '') {
moduleVersion = `${versions.module.id}-${versions.module.version}`
Expand All @@ -110,6 +110,10 @@ class JahiaTestrailReporter extends Command {
version = versions.module.version
name = versions.module.id
}
// If name could not be fetched from the module file, fallback on the flag value
if (name === '') {
name = flags.name
}

// Get all individual test cases in an array
const testCases: any = []
Expand All @@ -122,7 +126,7 @@ class JahiaTestrailReporter extends Command {
suite: suite.name,
duration: test.time,
state: test.status,
jahia: jahiaFullVersion,
jahia: jahiaVersion,
module: moduleVersion,
caseTotal: 1, // Hack to fit in Zencrepes ZUI existing data model
caseSuccess: test.status === 'PASS' ? 1 : 0,
Expand Down

0 comments on commit 2fcf6a6

Please sign in to comment.