forked from gusarin/jest-allure-reporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
33 lines (27 loc) · 910 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* jest-allure-reporter
* @author: Pascal Esemann
* @file: index.ts
* @description: Entrypoint for the reporter.
*/
import { JestResults } from "./jest_results";
import { Allure } from "./allure";
import { Testsuite } from "./testsuite";
class JestAllureReporter {
//Method is getting called after the tests ran.
public onRunComplete(contexts: any, results: any) {
//remove old Results
Allure.removeOldResults();
const testResultsAsJson = JestResults.onRunComplete(contexts, results);
results.testResults.forEach((suite: JSON) => {
const testsuite = new Testsuite(suite, testResultsAsJson);
testsuite.writeToFileAsAllureInput();
});
Allure.generateReport();
}
}
module.exports = (results: any) => {
const reporter = new JestAllureReporter();
reporter.onRunComplete(null, results);
return results;
};