From 4f99fe51986e1a4c7cc69565ba14b6fc8bfba214 Mon Sep 17 00:00:00 2001 From: Ryan Parker Date: Wed, 22 Jul 2020 23:14:49 -0500 Subject: [PATCH] fix(allure-reporter): removed logs and trimming comma separated pragmas --- src/allure-node-environment.ts | 6 ------ src/allure-reporter.ts | 22 +++++++++++++--------- src/category-definitions.ts | 2 +- src/step-wrapper.ts | 1 - 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/allure-node-environment.ts b/src/allure-node-environment.ts index 0da3c3d..3dd58bd 100644 --- a/src/allure-node-environment.ts +++ b/src/allure-node-environment.ts @@ -36,10 +36,6 @@ export default class AllureNodeEnvironment extends NodeEnvironment { }); this.global.allure = this.reporter.getImplementation(); - - if (this.docblockPragmas?.prototype !== undefined) { - console.log('this.docblockPragmas:', this.docblockPragmas); - } } async setup() { @@ -170,10 +166,8 @@ export default class AllureNodeEnvironment extends NodeEnvironment { break; case 'run_finish': - break; case 'teardown': - break; case 'error': /** @privateRemarks diff --git a/src/allure-reporter.ts b/src/allure-reporter.ts index 3646d64..0a18b6a 100644 --- a/src/allure-reporter.ts +++ b/src/allure-reporter.ts @@ -297,35 +297,39 @@ export default class AllureReporter { return match ? match[0].trimStart() : ''; } - private setAllureReportPragmas(pragmas: Record) { + private setAllureReportPragmas(pragmas: Record) { if (!this.currentTest) { throw new Error('No test running.'); } const test = this.currentTest; - for (const [pragma, value] of Object.entries(pragmas)) { + for (let [pragma, value] of Object.entries(pragmas)) { + if (Array.isArray(value)) { + console.debug({value}); + value = value.join(); + } + switch (pragma) { case 'issue': - test.addLink(`${this.jiraUrl}${(value as string)}`, (value as string), LinkType.ISSUE); + test.addLink(`${this.jiraUrl}${value}`, value, LinkType.ISSUE); break; case 'tms': - test.addLink(`${this.tmsUrl}${(value as string)}`, (value as string), LinkType.TMS); + test.addLink(`${this.tmsUrl}${value}`, value, LinkType.TMS); break; case 'tag': case 'tags': - // TODO: Make the comma space optional. - if ((value as string).includes(', ')) { - (value as string).split(', ').map((t: string) => test.addLabel(LabelName.TAG, t)); + if ((value).includes(',')) { + (value).split(',').map((t: string) => test.addLabel(LabelName.TAG, t.trim())); } else { - test.addLabel(LabelName.TAG, (value as string)); + test.addLabel(LabelName.TAG, value); } break; default: - test.addLabel(pragma, (value as string)); + test.addLabel(pragma, value); break; } diff --git a/src/category-definitions.ts b/src/category-definitions.ts index badc86a..f3408d2 100644 --- a/src/category-definitions.ts +++ b/src/category-definitions.ts @@ -42,7 +42,7 @@ const categories = [ ] }, { - name: 'Test timed out', + name: 'Timed out', description: 'The test exceeded the test threshold.', traceRegex: '.*Exceeded timeout.*', matchedStatuses: [ diff --git a/src/step-wrapper.ts b/src/step-wrapper.ts index 4ffb1bc..26ade61 100644 --- a/src/step-wrapper.ts +++ b/src/step-wrapper.ts @@ -1,7 +1,6 @@ import type {AllureStep, StepInterface, Stage, ContentType} from 'allure-js-commons'; import {Status} from 'allure-js-commons'; import type AllureReporter from './allure-reporter'; -// Import {JestAllureInterface} from './allure-interface'; export default class StepWrapper { constructor(private readonly reporter: AllureReporter, private readonly step: AllureStep) {}