Gathering detailed insights and metrics for jest-allure2-adapter
Gathering detailed insights and metrics for jest-allure2-adapter
Gathering detailed insights and metrics for jest-allure2-adapter
Gathering detailed insights and metrics for jest-allure2-adapter
npm install jest-allure2-adapter
Typescript
Module System
Node Version
NPM Version
TypeScript (98.29%)
JavaScript (1.71%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
4 Stars
117 Commits
4 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Mar 20, 2024
Latest Version
0.3.12
Package Id
jest-allure2-adapter@0.3.12
Unpacked Size
51.92 kB
Size
12.52 kB
File Count
26
NPM Version
8.19.2
Node Version
18.10.0
Published on
Jun 02, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Originally forked from jest-allure.
Add more power to your tests using Jest-Allure. Easily generate nice reports at the end of the execution.
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have been tested in a neat web report form, but allows everyone participating in the development process to extract maximum of useful information from everyday execution of tests.
yarn add -D jest-allure2-adapter
or
npm install --save-dev jest-allure2-adapter
Then add jest-allure2-adapter/dist/setup-default
to setupFilesAfterEnv
section of your config.
setupFilesAfterEnv: ["jest-allure2-adapter/dist/setup-default"]
reporters: ["default", "jest-allure2-adapter"],
Run tests. Results will be generated and stored in allure-results
folder.
Object of the following type can be added into registerAllureReporter as first argument.
1 resultsDir?: string; 2 stepTimestamp?: boolean; 3 addStepStatusDetailsAttachment?: boolean; // add attachment with step status details 4 tmsLink?: (id: string) => string; 5 issueLink?: (id: string) => string;
You need to install the CLI in order to obtain a report.
For example see allure-commandline.
To see a report in browser, run in console
allure serve
If you want to generate html version, run in console
allure generate
You can add description, screenshots, steps, severity and lots of other fancy stuff to your reports.
Global variable reporter
available in your tests with such methods:
test: AllureCurrentApi; // actions for current test
startGroup(name: string): void;
startTest(spec: jasmine_.CustomReporterResult): void;
startStep(name: string, start?: number): AllureStep;
stepStatus(status: Status, details?: StatusDetails | any): void;
step<T>(
name: string,
body?: (step: StepInterface) => T,
start?: number,
...args: any[]
): any;
endStep(
status?: Status,
stage?: Stage,
details?: StatusDetails | any,
end?: number,
): void;
endTest(spec: jasmine_.CustomReporterResult): void;
endGroup(): void;
writeCategories(categories: Category[]): void;
addEnvironment(name: string, value: string): this;
logStep(name: string, status: Status, attachments?: [Attachment]): void;
attachment(name: string, content: Buffer | string, type?: ContentType): void;
addParameter(name: string, value: string): this;
addParameters(...params: [string, any][]): this;
description(description: string): this; // sets description to current executable (test / step)
descriptionHtml(description: string): this; // sets description to current executable (test / step)
addDescription(description: string): void; // adds html description to test
setFullName(fullName: string): void;
setHistoryId(uid: string): void;
addPackage(value: string): this;
addLink(options: { name?: string; url: string; type?: LinkType }): this;
addIssue(options: { id: string; name?: string; url?: string }): this;
addTms(options: { id: string; name?: string; url?: string }): this;
addLabel(name: string, value: string): this;
feature(feature: string): void;
story(story: string): void;
tag(tag: string): void;
owner(owner: string): void;
lead(lead: string): void;
framework(framework: string): void;
language(language: string): void;
as_id(id: string): void;
host(host: string): void;
testClass(testClass: string): void;
testMethod(testMethod: string): void;
severity(severity: Severity): void;
To use custom jasmine reporter - for example to add smth into allure when spec or suite started you can use custom jasmine reporter.
In this case you do NOT need to add jest-allure2-adapter/dist/setup-default
into SetupFilesAfterEnv section.
Just call registerAllureReporter with yur custom jasmine reporter.
see example:
1// jest.setup.ts 2... 3setupFilesAfterEnv: [ 4 './config/jest-custom-reporter.ts', 5 ], 6...
1// jest-custom-reporter.ts 2 3import { 4 AllureReporterApi, 5 jasmine_, 6 registerAllureReporter, 7} from 'jest-allure2-adapter'; 8 9class JasmineAllureReporter implements jasmine_.CustomReporter { 10 private allure: AllureReporterApi; 11 12 constructor(allure: AllureReporterApi) { 13 this.allure = allure; 14 } 15 16 suiteStarted(suite?: jasmine_.CustomReporterResult) { 17 this.allure.startGroup(suite.description); 18 // some actions here on suite started 19 } 20 21 suiteDone() { 22 // some actions here on suite end 23 this.allure.endGroup(); 24 } 25 26 specStarted(spec: jasmine_.CustomReporterResult) { 27 this.allure.startTest(spec); 28 // some actions here on test started 29 } 30 31 specDone(spec: jasmine_.CustomReporterResult) { 32 // some actions here on spec end 33 this.allure.endTest(spec); 34 } 35} 36 37registerAllureReporter( 38 undefined, 39 (allure) => new JasmineAllureReporter(allure), 40);
Example (todo)
import { Severity } from "jest-allure/dist/Reporter";
import { Feature } from "somwhere in your project";
describe("Fancy test", () => {
...
it("Test your amazing feature", async () => {
reporter
.description("Feature should work cool")
.severity(Severity.Critical)
.feature(Feature.Betting)
.story("BOND-007");
reporter.startStep("Check it's fancy");
// expect that it's fancy
reporter.endStep();
reporter.startStep("Check it's cool");
// expect that it's cool
reporter.endStep();
const screenshotBuffer = await page.screenshot();
reporter.addAttachment("Screenshot", screenshotBuffer, "image/png");
});
...
}
);
jest-allure2-adapter
reporter dynamically configure "setupTestFrameworkScriptFile" option in Jest configuration.
If you have your own setupTestFrameworkScriptFile file, you need to manually register allure reporter, for it you need to import jest-allure/dist/setup-default.
1import 'jest-allure2-adapter/dist/setup-default';
In case if you have jest version > 24 just add jest-allure/dist/setup-default
to setupFilesAfterEnv
section of your config.
As far as describe is async setting feature/story under describe or in any other place in the file except test will add feature/story to all tests in this file (feature/story can be overridden in test)
Todo: add example
allure-results
tmsLink: (id) => http://someissue.com/${id}
)added addDescription (adds html description to test). Previously there was only ability to SET description.
It will add description to test1allure.test.addDescription('<h1>Heading</h1><br>'); 2... 3allure.test.addDescription('line<br>');
<h1>Heading</h1><br>line<br>
cleanup
Taisia Pitko |
---|
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More