Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Commit

Permalink
fix(allure-reporter): removed logs and trimming comma separated pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
ryparker committed Jul 23, 2020
1 parent 62c904a commit 4f99fe5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
6 changes: 0 additions & 6 deletions src/allure-node-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -170,10 +166,8 @@ export default class AllureNodeEnvironment extends NodeEnvironment {

break;
case 'run_finish':

break;
case 'teardown':

break;
case 'error':
/** @privateRemarks
Expand Down
22 changes: 13 additions & 9 deletions src/allure-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,35 +297,39 @@ export default class AllureReporter {
return match ? match[0].trimStart() : '';
}

private setAllureReportPragmas(pragmas: Record<string, any>) {
private setAllureReportPragmas(pragmas: Record<string, string|string[]>) {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/category-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const categories = [
]
},
{
name: 'Test timed out',
name: 'Timed out',
description: 'The test exceeded the test threshold.',
traceRegex: '.*Exceeded timeout.*',
matchedStatuses: [
Expand Down
1 change: 0 additions & 1 deletion src/step-wrapper.ts
Original file line number Diff line number Diff line change
@@ -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) {}
Expand Down

0 comments on commit 4f99fe5

Please sign in to comment.