Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add multiple-reporters example #2

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,63 @@ Zero config Mochawesome reporter for Cypress with screenshots
## Setup

1. install cypress-mochawesome-reporter

```
npm i --save-dev cypress-mochawesome-reporter
```

or

```
yarn add -D cypress-mochawesome-reporter
```

2. Change cypress reporter

config file

```
"reporter": "cypress-mochawesome-reporter"
```

or command line

```
--reporter cypress-mochawesome-reporter
```

3. Add to `cypress/support/index.js`

```
import 'cypress-mochawesome-reporter/register';
```

4. add to your package.json scripts

```
"cypress:report": "generate-mochawesome-report"
```

5. run cypress and then `npm run cypress:report`

## CLI (generate-mochawesome-report) flags
Flag | Type | Default | Description
:--- | :--- | :------ | :----------
--jsonDir | string | [cwd]/cypress/results/json | Cypress results json folder, should be the same as reportDir in cypress.json
--reportDir | string | [cwd]/cypress/screenshots | Cypress screenshots directory
-o, --output | string | [cwd]/cypress/reports/html | Path to save report

## Run example project
| Flag | Type | Default | Description |
| :----------- | :----- | :------------------------- | :--------------------------------------------------------------------------- |
| --jsonDir | string | [cwd]/cypress/results/json | Cypress results json folder, should be the same as reportDir in cypress.json |
| --reportDir | string | [cwd]/cypress/screenshots | Cypress screenshots directory |
| -o, --output | string | [cwd]/cypress/reports/html | Path to save report |

## Exmaples

1. [Simple use of `cypress-mochawesome-reporter`](examples/simple)
2. [Using `cypress-multi-reporters`](examples/multiple-reporters)

```
cd example
cd examples/<example-project>

npm i
npm run serve
npm run cypress:run
npm run cypress:report
```
```
File renamed without changes.
10 changes: 10 additions & 0 deletions examples/multiple-reporters/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"baseUrl": "http://localhost:3333",
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"reporterEnabled": "cypress-mochawesome-reporter, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "cypress/results/junit/results-[hash].xml"
}
}
}
Loading