Skip to content

Commit 5be22b2

Browse files
canoztokmakboneskull
authored andcommitted
options.reporterOptions are used for progress reporter
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.
1 parent ea96b18 commit 5be22b2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/reporters/progress.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ function Progress (runner, options) {
3939

4040
// default chars
4141
options = options || {};
42-
options.open = options.open || '[';
43-
options.complete = options.complete || '▬';
44-
options.incomplete = options.incomplete || Base.symbols.dot;
45-
options.close = options.close || ']';
46-
options.verbose = false;
42+
var reporterOptions = options.reporterOptions || {};
43+
44+
options.open = reporterOptions.open || '[';
45+
options.complete = reporterOptions.complete || '▬';
46+
options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
47+
options.close = reporterOptions.close || ']';
48+
options.verbose = reporterOptions.verbose || false;
4749

4850
// tests started
4951
runner.on('start', function () {

test/reporters/progress.spec.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ describe('Progress reporter', function () {
9090
incomplete: expectedIncomplete,
9191
close: expectedClose
9292
};
93+
var options = {
94+
reporterOptions: expectedOptions
95+
};
9396
runner.total = expectedTotal;
9497
runner.on = function (event, callback) {
9598
if (event === 'test end') {
9699
callback();
97100
}
98101
};
99-
Progress.call({}, runner, expectedOptions);
102+
Progress.call({}, runner, options);
100103

101104
process.stdout.write = stdoutWrite;
102105
var expectedArray = [

0 commit comments

Comments
 (0)