Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit cc5fc52

Browse files
authored
Refactor reporter handling
1 parent 493cc6c commit cc5fc52

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ module.exports = function gulpTestCafe (opts) {
5555
.screenshots(opts.screenshotsPath, opts.takeScreenshotsOnFail);
5656

5757
opts.reporter.forEach(function (reporter) {
58-
var outStream = reporter.outStream;
59-
60-
if (!outStream && reporter.file)
61-
outStream = fs.createWriteStream(reporter.file);
62-
63-
if (typeof reporter !== 'string')
64-
reporter = reporter.name || DEFAULT_REPORTER;
65-
66-
runner.reporter(reporter, outStream);
58+
if (typeof reporter === 'string')
59+
runner.reporter(reporter);
60+
else {
61+
runner.reporter(
62+
reporter.name || DEFAULT_REPORTER,
63+
reporter.file ? fs.createWriteStream(reporter.file) : reporter.outStream
64+
);
65+
}
6766
});
6867

6968
return runner.run(opts);

0 commit comments

Comments
 (0)