Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.29 KB

README.md

File metadata and controls

59 lines (40 loc) · 1.29 KB

allure-mocha

This project implements Allure integration with Mocha framework.

Installation

npm i allure-mocha mocha --save-dev

or via yarn:

yarn add allure-mocha mocha --dev

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

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

Usage

Either add allure-mocha into mocha.opts:

--reporter allure-mocha

Or pass the same value via commandline / scripts:

mocha -R allure-mocha

If you want to provide extra information, such as steps and attachments, import the allure object into your code:

// es-modules
import { allure } from 'allure-mocha/runtime';
// or commonjs
const { allure } = require('allure-mocha/runtime');

it('is a test', () => {
  allure.epic('Some info');
});

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.