UNPKG

@salesforce/apex-node

Version:

Salesforce JS library for Apex

47 lines 2.15 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TapReporter = void 0; const utils_1 = require("../utils"); const buildTapDiagnostics_1 = require("./buildTapDiagnostics"); class TapReporter { format(testResult, epilog) { utils_1.HeapMonitor.getInstance().checkHeapSize('TapReporter.format'); try { const results = this.buildTapResults(testResult); const lines = [ `1..${results.length}`, ...results.flatMap((testPoint) => [ `${testPoint.outcome} ${testPoint.testNumber} ${testPoint.description}`, ...testPoint.diagnostics.map((s) => `# ${s}`) ]), ...(epilog ? epilog.map((c) => `# ${c}`) : []) ]; return lines.join('\n') + '\n'; } finally { utils_1.HeapMonitor.getInstance().checkHeapSize('TapReporter.format'); } } buildTapResults(testResult) { return testResult.tests.map((test, index) => ({ testNumber: index + 1, description: test.fullName, diagnostics: (0, buildTapDiagnostics_1.buildTapDiagnostics)(test), outcome: test.outcome === "Pass" /* ApexTestResultOutcome.Pass */ ? 'ok' : 'not ok' })); } } exports.TapReporter = TapReporter; __decorate([ (0, utils_1.elapsedTime)() ], TapReporter.prototype, "format", null); __decorate([ (0, utils_1.elapsedTime)() ], TapReporter.prototype, "buildTapResults", null); //# sourceMappingURL=tapReporter.js.map