![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
jest-allure2
Advanced tools
An up to date Jest reporter that produces Allure 2 reports.
Originally forked from jest-allure, this project uses the latest allure configuration ^2.0.0-beta.6
.
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.
Features:
Most robust Allure API currently available to Jest.
Support for new attachment types that were not supported on previous versions.
Allure result files are now JSON, replacing the legacy XML format.
Resource | Description |
---|---|
Jest | A delightful JavaScript testing framework. |
Allure 2 CLI | "A Java jar command line tool that turns Allure result files into beautiful Allure reports." |
yarn add --dev jest-allure2
jest.setup.js
var { registerAllure } = require('jest-allure2')
registerAllure()
yarn test
allure generate
Add descriptions, screenshots, steps, severity and lots of other fancy details to the report.
The global
variable will have a new allure
object available with the following methods:
allure.description(description: string): this;
allure.severity(severity: Severity): this;
allure.epic(epic: string): this;
allure.feature(feature: string): this;
allure.story(story: string): this;
allure.step(name: string, status: string | (args:[any]) => string): this;
allure.environment(name: string, value: string): this;
allure.attachment(name: string, buffer: any, type: string): this;
allure.label(name: string, value: string): this;
allure.tag(name: string): this;
allure.parameter(name: string, value: string): this;
allure.issue(id: string): this;
allure.tms(id: string): this;
// Test subject
function sum(a: number, b: number): number {
return a + b
}
// Tests
describe('Number functions', () => {
beforeEach('Setup', () => {
allure.severity(Severity.Critical)
allure.feature(Feature.Billing)
allure.story('BILL-217')
})
test('sum performs addition functionality', () => {
allure.description('Tests should be ran when billing functionality is changed.')
allure.step('Two integers can be added together.', () => {
allure.parameter('a', 3)
allure.parameter('b', 4)
expect(sum(3, 4)).toBe(7)
})
allure.step('Two floats can be added together', () => {
allure.parameter('a', 3.141)
allure.parameter('b', 2.571)
expect(sum(3.141, 2.571)).toBe(5.712)
})
allure.step('Two objects can be added together', () => {
const a = { a: 1 }
const b = { b: 2 }
allure.parameter('a', a)
allure.parameter('b', b)
expect(sum(a, b)).toMatchSnapshot()
})
})
})
The main export registerAllure()
accepts three optional configuration arguments:
Parameter | Description | Default |
---|---|---|
resultsDir | File path where result files are written. | "allure-results" |
environmentInfo | Key value pairs that will appear under the environment section of the Allure report | {} |
testMapper | Decorator that receives Allure test result objects. | undefined |
// jest.setup.js
var resultsDir = 'allure-results'
var environmentInfo = { Username: 'User-1331', password: 'password-1331' }
var testMapper = (results) => {
if (result.status == Status.SKIPPED) {
result.fullName = `(WAS SKIPPED) ${result.fullName}`
}
return result
}
registerAllure(resultsDir, environmentInfo, testMapper)
FAQs
Allure 2 Reports for jest
The npm package jest-allure2 receives a total of 194 weekly downloads. As such, jest-allure2 popularity was classified as not popular.
We found that jest-allure2 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.