mocha-allure2-reporter-fixed
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Mocha Allure2 Reporter


This is fork of mocha-allure2-reporter, that allows to get rid of broken type declarations


Build Status codecov npm version

This project implements recent Allure 2 TS interface for Mocha framework.

Installation

npm i mocha-allure2-reporter mocha --save-dev

or via yarn:

yarn add mocha-allure2-reporter mocha --dev

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

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

allure2-js-commons comes as an implicit dependency.

Allure types configuration

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

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

Usage

Either add mocha-allure2-reporter into mocha.opts:

--ui mocha-typescript
--require source-map-support/register
--reporter mocha-allure2-reporter

Or pass the same value via commandline / scripts:

mocha -R mocha-allure2-reporter

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

const allure: AllureInterface = global.allure;

A full API is listed in AllureInterface.ts.

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.

/mocha-allure2-reporter-fixed/

    Package Sidebar

    Install

    npm i mocha-allure2-reporter-fixed

    Weekly Downloads

    17

    Version

    0.1.0

    License

    Apache-2.0

    Unpacked Size

    35 kB

    Total Files

    15

    Last publish

    Collaborators

    • iamolegga