|
60 | 60 | { log: true }, |
61 | 61 | { unknown: true }, |
62 | 62 | { classes: {} }, |
| 63 | + { custom: 'pretty' }, |
63 | 64 | ], |
64 | 65 | ({ title }, options) => { |
65 | 66 | test(`Options are validated | ${title}`, (t) => { |
@@ -113,3 +114,26 @@ test.serial('Can use together with modern-errors-beautiful', (t) => { |
113 | 114 | `${figures.cross} BothError: test`, |
114 | 115 | ) |
115 | 116 | }) |
| 117 | + |
| 118 | +test.serial('Can use aggregate errors', (t) => { |
| 119 | + const { consoleArg } = errorExit( |
| 120 | + new BaseError('test', { |
| 121 | + cli: { icon: 'warning' }, |
| 122 | + errors: [new BaseError('inner', { cli: { icon: 'info' } })], |
| 123 | + }), |
| 124 | + ) |
| 125 | + t.true(consoleArg.includes(`${figures.warning} BaseError: test`)) |
| 126 | + t.true(consoleArg.includes(`${figures.info} BaseError: inner`)) |
| 127 | +}) |
| 128 | + |
| 129 | +test('Returns beautified errors, static', (t) => { |
| 130 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call |
| 131 | + const prettyMessage: string = BaseError.pretty(error) |
| 132 | + t.true(prettyMessage.includes(`${figures.cross} BaseError: test`)) |
| 133 | +}) |
| 134 | + |
| 135 | +test('Returns beautified errors, instance', (t) => { |
| 136 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call |
| 137 | + const prettyMessage: string = error.pretty() |
| 138 | + t.true(prettyMessage.includes(`${figures.cross} BaseError: test`)) |
| 139 | +}) |
0 commit comments