dockest
Version:
Dockest is an integration testing tool aimed at alleviating the process of evaluating unit tests whilst running multi-container Docker applications.
28 lines • 931 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatZodError = void 0;
const zod_validation_error_1 = require("zod-validation-error");
/**
* Format a ZodError into a string with a newline per issue
*
* Completely missing fields in an object will be output as `Required at "path.to.field"`
*
* There's a hard limit of 100 issues in the message, so if you have more than 100 issues, you'll get a truncated message.
*/
function formatZodError(zodError,
/**
* The Zod model's name, E.g. "Person".
*/
modelName) {
const { message, name } = (0, zod_validation_error_1.fromZodError)(zodError, {
issueSeparator: '\n',
prefix: '',
prefixSeparator: '',
unionSeparator: '\n',
maxIssuesInMessage: 100,
});
return `[${name} for "${modelName}"]
${message}`;
}
exports.formatZodError = formatZodError;
//# sourceMappingURL=format-zod-error.js.map