Skip to content

Commit

Permalink
added reporter option
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Dec 15, 2015
1 parent cf305bf commit 29649dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/codecept.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ program.command('run [suite] [test]')
.option('-C, --no-colors', 'force disabling of colors')
.option('-G, --growl', 'enable growl notification support')
.option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')
.option('-R, --reporter <name>', 'specify the reporter to use', 'spec')
.option('-R, --reporter <name>', 'specify the reporter to use', 'codeceptjs')
.option('-S, --sort', "sort test files")
.option('-b, --bail', "bail after first test failure")
.option('-d, --debug', "enable node's debugger, synonym for node --debug")
Expand Down
8 changes: 8 additions & 0 deletions docs/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ Like in Mocha you can use `x` and `only` to skip tests or making a single test t
* `xScenario` - skips current test
* `Scenario.only` - executes only the current test
## Reporters
CodeceptJS supports [Mocha Reporters](https://mochajs.org/#reporters).
They can be used with `--reporter` optons.
By default a custom console reporter is enabled.
We are currently working on improving reporters support.
## Bootstrap
In case you need to execute arbitrary code before the tests,
Expand Down
8 changes: 7 additions & 1 deletion lib/codecept.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ class Codecept {
this.config = config;
this.mocha = new Mocha(Object.assign(config.mocha, opts));
this.mocha.ui(scenarioUi);
this.mocha.reporter(reporter, opts);
if (opts.reporter) {
// custom reporters
this.mocha.reporter(opts.reporter, opts.reporterOptions);
} else {
// standard reporter. TODO: make them run side by side
this.mocha.reporter(reporter, opts);
}
this.testFiles = [];
}

Expand Down

0 comments on commit 29649dc

Please sign in to comment.