Skip to content

Commit

Permalink
options.reporterOptions are used for progress reporter
Browse files Browse the repository at this point in the history
Progress reporter had multiple options for configuring the reporter,
but it needed the optional fields under `options` object, while
those fields are provided under `options.reporterOptions`.
This commit enables usage of optional fields from `reporterOptions`.
Updated test cases as well.
  • Loading branch information
canoztokmak committed Dec 27, 2017
1 parent ae3712c commit e0d29ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 7 additions & 5 deletions lib/reporters/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ function Progress (runner, options) {

// default chars
options = options || {};
options.open = options.open || '[';
options.complete = options.complete || '▬';
options.incomplete = options.incomplete || Base.symbols.dot;
options.close = options.close || ']';
options.verbose = false;
var reporterOptions = options.reporterOptions || {};

options.open = reporterOptions.open || '[';
options.complete = reporterOptions.complete || '▬';
options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
options.close = reporterOptions.close || ']';
options.verbose = reporterOptions.verbose || false;

// tests started
runner.on('start', function () {
Expand Down
5 changes: 4 additions & 1 deletion test/reporters/progress.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ describe('Progress reporter', function () {
incomplete: expectedIncomplete,
close: expectedClose
};
var options = {
reporterOptions: expectedOptions
};
runner.total = expectedTotal;
runner.on = function (event, callback) {
if (event === 'test end') {
callback();
}
};
Progress.call({}, runner, expectedOptions);
Progress.call({}, runner, options);

process.stdout.write = stdoutWrite;
var expectedArray = [
Expand Down

0 comments on commit e0d29ad

Please sign in to comment.