UNPKG

@conduitvc/jest-allure-reporter

Version:

A Jest Allure Reporter, which takes the test-results from jest and creates an allure-report from it.

36 lines (30 loc) 1.12 kB
/** * jest-allure-reporter * @author: Pascal Esemann * @file: testsuite.ts * @description: Class for representing a testcase. */ import { Testcase } from "./testcase"; import { Allure } from "./allure"; //Getting testsuite-related data from the json-results of the testsuite. export class Testsuite { public testSuiteResults: any; public startTime: string; public stopTime: string; public name: string; public testcases: Testcase[]; constructor(testSuiteResults: any, jsonResults: any) { this.testSuiteResults = testSuiteResults; this.startTime = testSuiteResults.perfStats.start; this.stopTime = testSuiteResults.perfStats.end; this.name = testSuiteResults.testFilePath.split(/(\/|\\)/g).pop(); this.testcases = []; this.testSuiteResults.testResults.forEach((testcase: JSON) => { this.testcases.push(new Testcase(testcase, jsonResults)); }); } //Triggering creation of an XML-resultfile from the testsuites data. public writeToFileAsAllureInput() { Allure.generateAllureXMLOutput(this); } }