(issue: ReadableIssue)
| 838 | |
| 839 | /** @internal formats a standalone issue as its line in `errors.summary` */ |
| 840 | export const issueLineOf = (issue: ReadableIssue): string => { |
| 841 | const defaultMessage = messageOf(issue) |
| 842 | const message = issue.message ?? defaultMessage |
| 843 | // every key of a build holding neither an index nor a key to bracket is an |
| 844 | // identifier, so its path is its keys joined, and it holds no pathOf |
| 845 | const path = |
| 846 | reportsIndices || bracketsKeys ? pathOf(issue) : issue.path.join(".") |
| 847 | return ( |
| 848 | listsUnions && (issue as ArkIssue)._l !== undefined ? |
| 849 | (issue as ArkIssue)._l! |
| 850 | : labelsValues && isLabeledIssue(issue, message, defaultMessage) ? |
| 851 | labeledPathOf(issue) + message |
| 852 | : path ? |
| 853 | path + |
| 854 | (( |
| 855 | writesText && |
| 856 | !(message === "is invalid" && issue.expected === "valid") && |
| 857 | !message.startsWith(defaultMessage) |
| 858 | ) ? |
| 859 | ": " |
| 860 | : " ") + |
| 861 | message |
| 862 | : message |
| 863 | ) |
| 864 | } |
| 865 | |
| 866 | /** |
| 867 | * Formats an error as its line in `errors.summary`, e.g. |
no test coverage detected