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

fix: Improve third-party reporters example #104

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
13 changes: 7 additions & 6 deletions packages/third-party-reporter/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Third party reporter
# Third-party reporter

Full documentation about it [here](https://github.com/mochajs/mocha/wiki/Third-party-reporters).
Mocha supports third-party reporters that can support advanced or specific use-cases. A reporter wraps around a [Runner](https://mochajs.org/api/runner) object and optionally listens to the events it emits.

To use a reporter published on npm (e.g., lcov-reporter), install it locally and set `--reporter lcov-reporter`.
To use a reporter published on npm (e.g., lcov-reporter), install it locally and set `--reporter lcov-reporter`. Alternatively, you can set the reporter in `.mocharc.json` as we've done here.

It is a very similar setup for `third party UI's`, for more details see [here](https://github.com/mochajs/mocha/wiki/Third-party-UIs).
It is a very similar setup for [third party UI's](https://github.com/mochajs/mocha/wiki/Third-party-UIs).

## Commands
For more details, including a list of which argument types go with which runner event, see [Tutorial: Create a Custom Reporter](https://mochajs.org/api/tutorial-custom-reporter).

- `npm test` - run our tests using the local `.mocharc.json` config file. They are run from the default location (`/test`) with the reporter found in `src/my-reporter.js`. In this example there is 1 failing test included, to demonstrate handling.
## Commands

- `npm test` - run our tests using the local `.mocharc.json` config file. They are run from the default location (`/test`) with the reporter found in `src/my-reporter.js`.
3 changes: 0 additions & 3 deletions packages/third-party-reporter/index.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/third-party-reporter/test/unit/my-reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ describe('Third party reporter usage', () => {
it('should equal true', () => {
equal(true, true);
});

it('should fail', () => {
equal(true, false);
})
});
Loading