allure-mochajs
allure-mochajs
npm i allure-mochajs
allure-mochajs

allure-mochajs

Allure integrations for JavaScript test frameworks

by allure-framework

2.0.0-beta.3 (see all)License:Apache-2.0TypeScript:Built-In
npm i allure-mochajs
Readme

allure-mochajs

This project implements Allure integration with Mocha framework.

Installation

npm i allure-mochajs mocha --save-dev

or via yarn:

yarn add allure-mochajs mocha --dev

Note that it's recommended to add the following dependencies as well for better user experience:

  • typescript
  • mocha-typescript
  • source-map-support

Allure types configuration

Add the following into your tsconfig.json to access exported Allure types.

    "typeRoots": [
      "./node_modules/allure-js-commons/dist/declarations/**/"
    ]

Usage

Either add allure-mochajs into mocha.opts:

--ui mocha-typescript
--require source-map-support/register
--reporter allure-mochajs

Or pass the same value via commandline / scripts:

mocha -R allure-mochajs

Now you can access a global allure object from within your project:

const allure: AllureInterface = global.allure;

Decorators Support

To make tests more readable and avoid explicit API calls, you can use a special extension - ts-test-decorators.

Examples

See mocha-allure2-example project, which is already configured to use latest Allure 2 features with decorators support.

Thanks

@srg-kostyrko for help and assistance.

No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate