( issue: ArkIssue, context: Record<string, unknown>, [expected, actual, message]: readonly Writer[], keeps: number )
| 786 | // message is configured for its code and 8 if its default message names its |
| 787 | // value by the label its meta holds |
| 788 | const writeIssue = ( |
| 789 | issue: ArkIssue, |
| 790 | context: Record<string, unknown>, |
| 791 | [expected, actual, message]: readonly Writer[], |
| 792 | keeps: number |
| 793 | ): void => { |
| 794 | const text: Record<string, unknown> = { |
| 795 | expected: issue.expected, |
| 796 | // one supplied where it's raised, which is its own |
| 797 | message: context.message |
| 798 | } |
| 799 | if (keeps & 2 && text.message === undefined) codedIssue(issue) |
| 800 | // a missing key's label is its value's. Each read of the flag is its |
| 801 | // statement's own, so a build labeling nothing folds both |
| 802 | if (labelsValues && keeps & 8) { |
| 803 | labeledIssue( |
| 804 | issue, |
| 805 | ( |
| 806 | (issue.code === "required" ? context.valueMeta : context.meta) as { |
| 807 | label: string |
| 808 | } |
| 809 | ).label |
| 810 | ) |
| 811 | } |
| 812 | const writeText = () => { |
| 813 | const error: Record<string, unknown> = { |
| 814 | data: issue.data, |
| 815 | path: issue.path, |
| 816 | ...context, |
| 817 | propString: stringifyPath(issue.path) |
| 818 | } |
| 819 | const write = (writer: Writer, ...args: unknown[]): unknown => |
| 820 | typeof writer === "function" ? writer(...args, enInfo) : writer |
| 821 | error.expected = context.expected ?? write(expected, error) ?? text.expected |
| 822 | if (context.actual !== undefined) error.actual = context.actual |
| 823 | else { |
| 824 | if (keeps & 4) describeActual(error) |
| 825 | error.actual = write(actual, issue.data, error) |
| 826 | } |
| 827 | if (keeps & 1) text.expected = error.expected |
| 828 | text.message ??= |
| 829 | labelsValues && keeps & 8 ? |
| 830 | `${issue._n} ${write(message, error)}` |
| 831 | : write(message, error) |
| 832 | for (const k in text) { |
| 833 | defineProperty(issue, k, { |
| 834 | value: text[k], |
| 835 | writable: true, |
| 836 | enumerable: true, |
| 837 | configurable: true |
| 838 | }) |
| 839 | } |
| 840 | } |
| 841 | for (const k in text) { |
| 842 | defineProperty(issue, k, { |
| 843 | get: () => (writeText(), issue[k as never]), |
| 844 | enumerable: true, |
| 845 | configurable: true |
no test coverage detected