This project implements Allure integration with Mocha framework.
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:
Add the following into your tsconfig.json to access exported Allure types.
"typeRoots": [
"./node_modules/allure-js-commons/dist/declarations/**/"
]
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;
To make tests more readable and avoid explicit API calls, you can use a special extension - ts-test-decorators.
See mocha-allure2-example project, which is already configured to use latest Allure 2 features with decorators support.
@srg-kostyrko for help and assistance.
Version | Tag | Published |
---|---|---|
2.0.0-beta.3 | latest | 4yrs ago |