"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const flatten_1 = require("../common/flatten");
const results_1 = require("../results");
function logResults(logger, results) {
    return __awaiter(this, void 0, void 0, function* () {
        const stats = results_1.getTestStats(flatten_1.chain(x => x.results, results));
        yield logger.log(results_1.resultsToString(results));
        yield logger.log(results_1.statsToString(stats));
        return results;
    });
}
exports.logResults = logResults;
function logTypeCheckResults(logger, { exitCode = 0, stderr = '', stdout = '' }) {
    return __awaiter(this, void 0, void 0, function* () {
        if (stdout) {
            yield logger.log(stdout.trim());
        }
        if (exitCode > 0 && stderr) {
            yield logger.error(stderr.trim());
        }
    });
}
exports.logTypeCheckResults = logTypeCheckResults;
//# sourceMappingURL=log.js.map