UNPKG

dts-jest

Version:

A preprocessor for Jest to snapshot test TypeScript declaration (.d.ts) files

34 lines (33 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Reporter = void 0; var path = require("path"); var definitions_1 = require("./definitions"); var create_typescript_info_1 = require("./utils/create-typescript-info"); var normalize_config_1 = require("./utils/normalize-config"); var Reporter = /** @class */ (function () { function Reporter(global_config) { this.global_config = global_config; } // istanbul ignore next Reporter.prototype.onRunStart = function () { }; // istanbul ignore next Reporter.prototype.getLastError = function () { }; Reporter.prototype.onRunComplete = function (contexts) { // istanbul ignore next var write_stream = this.global_config.useStderr ? process.stderr : process.stdout; write_stream.write('\n'); contexts.forEach(function (context) { var _a = (0, normalize_config_1.normalize_config)(context.config.globals[definitions_1.config_namespace]), ts = _a.typescript, typescript_path = _a.typescript_path; // istanbul ignore next var context_name = contexts.size > 1 ? " ".concat(path.basename(context.config.rootDir), ": ") : ' '; var typescript_info = (0, create_typescript_info_1.create_typescript_info)(ts.version, typescript_path, false); write_stream.write("[dts-jest]".concat(context_name).concat(typescript_info, "\n")); }); write_stream.write('\n'); }; return Reporter; }()); exports.Reporter = Reporter;