-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,45 @@ | |
Allure integration Jasmine framework | ||
|
||
For usage example see `test/Setup.ts` | ||
|
||
## Usage with Jest (`jest@<27`) | ||
|
||
> If you're looking for `jest-circus` integration (`[email protected]`) you need to | ||
> use [`allure-jest` package][allure-jest] instead. | ||
Use your favorite node package manager to install required packages: | ||
|
||
```bash | ||
npm i -D jest-jasmine2 allure-jasmine allure-js-commons @types/jasmine | ||
``` | ||
|
||
Create `allure-setup.ts` file: | ||
|
||
```ts | ||
import { JasmineAllureReporter } from "allure-jasmine"; | ||
import { JasmineAllureInterface } from "allure-jasmine/dist/src/JasmineAllureReporter"; | ||
|
||
const reporter = new JasmineAllureReporter({ resultsDir: "allure-results" }); | ||
|
||
jasmine.getEnv().addReporter(reporter); | ||
// @ts-expect-error | ||
global.allure = reporter.getInterface(); | ||
|
||
declare global { | ||
const allure: JasmineAllureInterface; | ||
} | ||
``` | ||
|
||
Change your `jest.config.js` file: | ||
|
||
```js | ||
module.exports = { | ||
preset: "ts-jest", | ||
+ testRunner: "jest-jasmine2", | ||
+ setupFilesAfterEnv: ["./allure-setup.ts"], | ||
}; | ||
``` | ||
|
||
You can find example setup and usage in this [repo](https://github.com/vovsemenv/allure-jest-example) | ||
|
||
[allure-jest]: https://github.com/allure-framework/allure-js/tree/master/packages/allure-jest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters