Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
jest-allure
Advanced tools
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-allure
or
npm install --save-dev jest-allure
Then add jest-allure/dist/setup
to setupFilesAfterEnv
section of your config.
setupFilesAfterEnv: ["jest-allure/dist/setup"]
reporters: ["default", "jest-allure"],
Run your tests and enjoy 🥤🚀
You need to install the CLI in order to obtain a report.
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:
description(description: string): this;
severity(severity: Severity): this;
epic(epic: string): this;
feature(feature: string): this;
story(story: string): this;
startStep(name: string): this;
endStep(status?: Status): this;
addArgument(name: string): this;
addEnvironment(name: string, value: string): this;
addAttachment(name: string, buffer: any, type: string): this;
addLabel(name: string, value: string): this;
addParameter(paramName: string, name: string, value: string): this;
Example
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-allure
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.
import "jest-allure/dist/setup";
In case if you have jest version > 24 just add jest-allure/dist/setup
to setupFilesAfterEnv
section of your config.
Denis Artyuhovich | Dmitry Bogomya |
---|
FAQs
Allure Reports for jest
The npm package jest-allure receives a total of 27,841 weekly downloads. As such, jest-allure popularity was classified as popular.
We found that jest-allure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.