persona-community-5/.pnpm-store/v3/files/07/6670e2da58c86bec6c90aeab35e58e4616337c1724774bbd01efc1fd6e3198684d1bd3619d70de2c7bf037d1e6b3a4d3061a8753e1a0d6b9c81352660dc505
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

61 lines
2.0 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chai = require("chai");
var assert = chai.assert;
var index_1 = require("../src/index");
function testErrors(input, expectedErrors) {
var errorsMap = {};
for (var _i = 0, expectedErrors_1 = expectedErrors; _i < expectedErrors_1.length; _i++) {
var e = expectedErrors_1[_i];
var key = e.message + " at line " + e.line + " column " + e.column;
if (e.isWarning) {
key += " (warning)";
}
errorsMap[key] = true;
}
var ast = safeLoad(input);
if (!ast) {
assert.fail("The parser has failed to load YAML AST");
}
var actualErrors = ast.errors;
if (actualErrors.length == 0 && expectedErrors.length == 0) {
assert(true);
return;
}
var unexpectedErrorsMap = {};
for (var _a = 0, actualErrors_1 = actualErrors; _a < actualErrors_1.length; _a++) {
var e = actualErrors_1[_a];
var key = e.reason + " at line " + e.mark.line + " column " + e.mark.column;
if (e.isWarning) {
key += " (warning)";
}
if (!errorsMap[key]) {
unexpectedErrorsMap[key] = e;
}
else {
delete errorsMap[key];
}
}
var missingErrors = Object.keys(errorsMap);
var unexpectedErrorKeys = Object.keys(unexpectedErrorsMap);
if (missingErrors.length == 0 && unexpectedErrorKeys.length == 0) {
assert(true);
return;
}
var messageComponents = [];
if (unexpectedErrorKeys.length > 0) {
messageComponents.push("Unexpected errors:\n" + unexpectedErrorKeys.join('\n'));
}
if (missingErrors.length > 0) {
messageComponents.push("Missing errors:\n" + missingErrors.join('\n'));
}
var testFailureMessage = "\n" + messageComponents.join("\n\n");
assert(false, testFailureMessage);
}
exports.testErrors = testErrors;
;
function safeLoad(input) {
return index_1.safeLoad(input, {});
}
exports.safeLoad = safeLoad;
//# sourceMappingURL=testUtil.js.map