Files
vscode/build/lib/reporter.js
Joao Moreno 23afe96996 revert changes to gulp files
Revert "oops"

This reverts commit 2be0f1d8cd.

Revert "cleanup top level gulpfile"

This reverts commit 849311713d.

Revert "use strict"

This reverts commit b6b7e82041.

Revert "forgot top level"

This reverts commit 1552828709.

Revert "remove VSCODE_BUILD_QUIET"

This reverts commit 8df5e70d12.
2016-07-12 11:47:48 +02:00

57 lines
1.2 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var es = require('event-stream');
var _ = require('underscore');
var allErrors = [];
var count = 0;
function onStart() {
if (count++ > 0) {
return;
}
console.log('*** Starting...');
}
function onEnd() {
if (--count > 0) {
return ;
}
var errors = _.flatten(allErrors);
errors.map(function (err) { console.error('*** Error:', err); });
console.log('*** Finished with', errors.length, 'errors.');
}
module.exports = function () {
var errors = [];
allErrors.push(errors);
var result = function (err) {
errors.push(err);
};
result.end = function (emitError) {
errors.length = 0;
onStart();
return es.through(null, function () {
onEnd();
if (emitError && errors.length > 0) {
this.emit('error', 'Errors occurred.');
} else {
this.emit('end');
}
});
};
result.hasErrors = function() {
return errors.length > 0;
}
return result;
};