Skip to content

Commit 42b6858

Browse files
committed
reporters: minor refactoring
1 parent 38ffc85 commit 42b6858

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

lib/reporters.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,33 @@ function defaultReporter(result) {
1818

1919
// Select a reporter (if not using the default Grunt reporter)
2020
function selectReporter(options) {
21-
switch (options.reporter) {
21+
let { reporter } = options;
22+
23+
switch (reporter) {
2224
case 'checkstyle': {
23-
// Checkstyle XML reporter
24-
options.reporter = '../lib/reporters/checkstyle.js';
25+
reporter = './reporters/checkstyle.js';
2526
break;
2627
}
2728

2829
case 'json': {
29-
// JSON reporter
30-
options.reporter = '../lib/reporters/json.js';
30+
reporter = './reporters/json.js';
3131
break;
3232
}
3333

3434
case 'junit': {
35-
// JUnit reporter
36-
options.reporter = '../lib/reporters/junit.js';
35+
reporter = './reporters/junit.js';
3736
break;
3837
}
3938

4039
default: {
41-
if (options.reporter !== null && typeof options.reporter !== 'undefined') {
42-
// Custom reporter
43-
options.reporter = path.resolve(process.cwd(), options.reporter);
40+
// Custom reporter if specified
41+
if (reporter !== null && typeof reporter !== 'undefined') {
42+
reporter = path.resolve(process.cwd(), reporter);
4443
}
4544
}
4645
}
4746

48-
return options.reporter ? require(options.reporter) : defaultReporter;
47+
return reporter ? require(reporter) : defaultReporter;
4948
}
5049

5150
module.exports = {

0 commit comments

Comments
 (0)