Gathering detailed insights and metrics for jest-circus-allure-environment
Gathering detailed insights and metrics for jest-circus-allure-environment
Gathering detailed insights and metrics for jest-circus-allure-environment
Gathering detailed insights and metrics for jest-circus-allure-environment
npm install jest-circus-allure-environment
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
21 Stars
269 Commits
14 Forks
1 Watching
11 Branches
3 Contributors
Updated on 26 Jun 2023
TypeScript (90.77%)
JavaScript (9.23%)
Cumulative downloads
Total Downloads
Last day
0.7%
281
Compared to previous day
Last week
38.3%
1,420
Compared to previous week
Last month
40%
5,248
Compared to previous month
Last year
-69.1%
86,836
Compared to previous year
12
18
:warning: Not actively maintained. Feel free to fork the code.
A Jest Circus environment for Allure reporting.
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." |
1yarn add --dev jest-circus-allure-environment
jest.config.js
See the testEnvironment docs for configuration details.
1{ 2 "testEnvironment": "jest-circus-allure-environment", 3 "testRunner": "jest-circus/runner" 4}
1yarn test
1allure serve ./allure-results
To provide more information in your reports you can use Docblock pragmas within your tests. For types support you'll need some additional configuration.
1// simple.test.js 2 3test('2 + 3 is 5', () => { 4 /** My test description. 5 * @epic Implement addition functionality 6 * @tag Accounting 7 */ 8 9 expect(2 + 3).toBe(5) 10})
jest.setup.js
file1// jest.setup.js 2 3import 'jest-circus-allure-environment' // Typescript or ESM 4require('jest-circus-allure-environment') // CommonJS
jest.setup.js
file is properly configured.See the setupFilesAfterEnv docs for configuration details.
1// jest.config.js 2 3{ 4 "setupFilesAfterEnv": ["./jest.setup.js"] 5}
Options that can be passed into the environmentOptions
property of your jest.config.js
Parameter | Description | Default |
---|---|---|
resultsDir | Path where Allure result files will be written. | "allure-results" |
jiraUrl | URL to Jira instance. Any @issue docblock pragmas will link to this URL. | undefined |
tmsUrl | URL to TMS instance. Any @tms docblock pragmas will link to this URL. | undefined |
environmentInfo | Key value pairs that will appear under the environment section of the Allure report | {} |
categories | Array of custom categories you wish to see in the Allure report. See an example | [] |
testPath | Path to your test files. This path will be subtracted from the Allure report when organizing tests into suites. | Jest.config.rootDir |
You may set code comments inside your tests called DocBlocks, that can be parsed for specific allure report pragmas. These are the supported DocBlock pragmas you may add to a test.
Add descriptions that document the tested functionality.
1test('does something important, when triggered by user', () => { 2 /** This uses a 3rd party API that typically undergoes maintenance on Tuesdays. 3 */ 4 5 ... 6})
Tag a test with a custom label.
Set multiple tags using a ,
deliminator.
1test('does something important, when triggered by user', () => { 2 /** 3 * @tag beta 4 * @tag feature-flagged, api-v3 5 */ 6 7 ... 8})
Set an owner for a test.
1test('does something important, when triggered by user', () => { 2 /** 3 * @owner ios-team 4 */ 5 6 .. 7})
Mark tests with a severity rating to indicate the importance of the tested functionality in respect to the overall application.
Level | Description |
---|---|
blocker | Tests that if failing, will halt further development. |
critical | Tests that must pass; or risk disrupting crucial application logic. |
normal (default) | Tests that are of average importance to the overall application. |
minor | Tests that if failing, should only effect a small subset of the application. |
trivial | Tests that validate unreleased, disabled, or deprecated features. |
Example of setting a test as "critical" severity
1test('does something important, when triggered by user', () => { 2 /** 3 * @severity critical 4 */ 5 6 ... 7})
Mark tests with a behavior label to organize tests in a feature based hierarchy.
Level | Description |
---|---|
epic | Tests that if fail, will effect the expected functionality of an epic. |
feature | Tests that if fail, will effect the expected functionality of a feature. |
story | Tests that if fail, will effect the expected functionality of story. |
Example:
1test('validation message appears, when email field is skipped', () => { 2 /** 3 * @epic Automate user sign up 4 * @feature Registration page 5 * @story Validate required registration fields before creating new user 6 */ 7 8 ... 9})
Add Jira and TMS links to a test.
Level | Description |
---|---|
issue | Adds a link to the test report that will open an existing issue in Jira. |
tms | Adds a link to the test report that will open an existing test case in your test management system. |
Example:
1test('validation message appears, when email field is skipped', () => { 2 /** 3 * @issue DEBT-60 4 * @tms CORE-122 5 */ 6 7 ... 8})
An instance of the allure runtime will be available on the Node global variable. You can utilize it's APIs to provide custom reporting functionality.
1/** 2 * Returns the Allure test instance for the currently running test. 3 */ 4allure.currentTest(): AllureTest; 5 6/** 7 * Adds a description to the report of the current test. Supports markdown. 8 */ 9allure.description(markdown: string): void; 10 11/** 12 * Starts and returns a new step instance on the current executable. 13 */ 14allure.startStep(name: string): StepWrapper; 15 16/** 17 * Starts a new Allure step, sets the status, and adds any provided attachments (optional), then ends the step. 18 */ 19allure.logStep( 20 name: string, 21 status: Status, 22 attachments?: Array<{ name: string; content: string; type: ContentType }> 23): void; 24 25/** 26 * Add a parameter to the report of the current executable. 27 */ 28allure.parameter(name: string, value: string): void; 29 30/** 31 * Attach a file to the report of the current executable. 32 */ 33allure.attachment( 34 name: string, 35 content: Buffer | string, 36 type: ContentType 37); 38 39/** 40 * Add a issue link to the report of the current test. 41 */ 42allure.issue(id: string): void; 43 44/** 45 * Add a TMS link to the report of the current test. 46 */ 47allure.tms(id: string): void; 48 49/** 50 * Add a severity label to the report of the current test. 51 */ 52allure.severity(severity: Severity): void; 53 54/** 55 * Add a epic label to the report of the current test. 56 */ 57allure.epic(epic: string): void; 58 59/** 60 * Add a feature label to the report of the current test. 61 */ 62allure.feature(feature: string): void; 63 64/** 65 * Add a story label to the report of the current test. 66 */ 67allure.story(story: string): void; 68 69/** 70 * Add a tag label to the report of the current test. 71 */ 72allure.tag(name: string): void; 73 74/** 75 * Add a custom label to the report of the current test. 76 */ 77allure.label(name: string, value: string): void;
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
project is archived
Details
Reason
Found 2/24 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
37 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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