Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sskorol/mocha-allure2-reporter
Allure 2 reporter for Mocha framework
https://github.com/sskorol/mocha-allure2-reporter
allure mocha mocha-typescript typescript
Last synced: about 1 month ago
JSON representation
Allure 2 reporter for Mocha framework
- Host: GitHub
- URL: https://github.com/sskorol/mocha-allure2-reporter
- Owner: sskorol
- License: apache-2.0
- Created: 2018-10-29T20:19:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-19T19:49:36.000Z (over 5 years ago)
- Last Synced: 2024-10-06T10:17:05.994Z (about 1 month ago)
- Topics: allure, mocha, mocha-typescript, typescript
- Language: TypeScript
- Size: 75.2 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mocha Allure2 Reporter
[![Build Status](https://travis-ci.com/sskorol/mocha-allure2-reporter.svg?branch=master)](https://travis-ci.com/sskorol/mocha-allure2-reporter)
[![codecov](https://codecov.io/gh/sskorol/mocha-allure2-reporter/branch/master/graph/badge.svg)](https://codecov.io/gh/sskorol/mocha-allure2-reporter)
[![npm version](https://badge.fury.io/js/mocha-allure2-reporter.svg)](https://badge.fury.io/js/mocha-allure2-reporter)This project implements recent Allure 2 TS [interface](https://github.com/korobochka/allure2-js-commons) for Mocha framework.
## Installation
```bash
npm i mocha-allure2-reporter mocha --save-dev
```
or via yarn:
```bash
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](https://github.com/korobochka/allure2-js-commons) comes as an implicit dependency.## Allure types configuration
Add the following into your **tsconfig.json** to access exported Allure types.
```json
"typeRoots": [
"./node_modules/allure2-js-commons/dist/declarations/**/"
]
```## Usage
Either add **mocha-allure2-reporter** into **mocha.opts**:
```text
--ui mocha-typescript
--require source-map-support/register
--reporter mocha-allure2-reporter
```Or pass the same value via commandline / scripts:
```bash
mocha -R mocha-allure2-reporter
```Now you can access a global **allure** object from within your project:
```typescript
const allure: AllureInterface = global.allure;
```A full API is listed in [AllureInterface.ts](https://github.com/korobochka/allure2-js-commons/blob/master/src/AllureInterface.ts).
## Decorators Support
To make tests more readable and avoid explicit API calls, you can use a special extension - [ts-test-decorators](https://github.com/sskorol/ts-test-decorators).
## Examples
See [mocha-allure2-example](https://github.com/sskorol/mocha-allure2-example) project, which is already configured to use latest Allure 2 features with decorators support.
## Thanks
[@srg-kostyrko](https://github.com/srg-kostyrko) for help and assistance.