Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of the project name #99

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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