| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1fa6352 commit 0923cbc
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,8 +195,10 @@ function jsToYaml(indent, name, value) { | |||
| 195 | 195 | actual, | |
| 196 | 196 | operator, | |
| 197 | 197 | stack, | |
| 198 | + name, | ||
| 198 | 199 | } = value; | |
| 199 | 200 | let errMsg = message ?? '<unknown error>'; | |
| 201 | + let errName = name; | ||
| 200 | 202 | let errStack = stack; | |
| 201 | 203 | let errCode = code; | |
| 202 | 204 | let errExpected = expected; | |
@@ -209,6 +211,7 @@ function jsToYaml(indent, name, value) { | |||
| 209 | 211 | if (code === 'ERR_TEST_FAILURE' && kUnwrapErrors.has(failureType)) { | |
| 210 | 212 | errStack = cause?.stack ?? errStack; | |
| 211 | 213 | errCode = cause?.code ?? errCode; | |
| 214 | + errName = cause?.name ?? errName; | ||
| 212 | 215 | if (isAssertionLike(cause)) { | |
| 213 | 216 | errExpected = cause.expected; | |
| 214 | 217 | errActual = cause.actual; | |
@@ -225,6 +228,9 @@ function jsToYaml(indent, name, value) { | |||
| 225 | 228 | if (errCode) { | |
| 226 | 229 | result += jsToYaml(indent, 'code', errCode); | |
| 227 | 230 | } | |
| 231 | + if (errName && errName !== 'Error') { | ||
| 232 | + result += jsToYaml(indent, 'name', errName); | ||
| 233 | + } | ||
| 228 | 234 | ||
| 229 | 235 | if (errIsAssertion) { | |
| 230 | 236 | result += jsToYaml(indent, 'expected', errExpected); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,9 +42,13 @@ function reConstructError(parsedYaml) { | |||
| 42 | 42 | } else { | |
| 43 | 43 | // eslint-disable-next-line no-restricted-syntax | |
| 44 | 44 | cause = new Error(parsedYaml.error); | |
| 45 | + } | ||
| 46 | + const name = parsedYaml.name ?? 'Error'; | ||
| 47 | + cause.stack = `${name}: ${parsedYaml.error}\n${stack}`; | ||
| 48 | + | ||
| 49 | + if (!isAssertionError && !isTestFailure) { | ||
| 45 | 50 | cause.code = parsedYaml.code; | |
| 46 | 51 | } | |
| 47 | - cause.stack = stack; | ||
| 48 | 52 | ||
| 49 | 53 | if (isTestFailure) { | |
| 50 | 54 | error = new ERR_TEST_FAILURE(cause, parsedYaml.failureType); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,7 @@ TAP version 13 | |||
| 43 | 43 | failureType: 'testAborted' | |
| 44 | 44 | error: 'This operation was aborted' | |
| 45 | 45 | code: 20 | |
| 46 | + name: 'AbortError' | ||
| 46 | 47 | stack: |- | |
| 47 | 48 | * | |
| 48 | 49 | * | |
@@ -62,6 +63,7 @@ TAP version 13 | |||
| 62 | 63 | failureType: 'testAborted' | |
| 63 | 64 | error: 'This operation was aborted' | |
| 64 | 65 | code: 20 | |
| 66 | + name: 'AbortError' | ||
| 65 | 67 | stack: |- | |
| 66 | 68 | * | |
| 67 | 69 | * | |
@@ -81,6 +83,7 @@ TAP version 13 | |||
| 81 | 83 | failureType: 'testAborted' | |
| 82 | 84 | error: 'This operation was aborted' | |
| 83 | 85 | code: 20 | |
| 86 | + name: 'AbortError' | ||
| 84 | 87 | stack: |- | |
| 85 | 88 | * | |
| 86 | 89 | * | |
@@ -100,6 +103,7 @@ not ok 1 - promise timeout signal | |||
| 100 | 103 | failureType: 'testAborted' | |
| 101 | 104 | error: 'The operation was aborted due to timeout' | |
| 102 | 105 | code: 23 | |
| 106 | + name: 'TimeoutError' | ||
| 103 | 107 | stack: |- | |
| 104 | 108 | * | |
| 105 | 109 | * | |
@@ -113,6 +117,7 @@ not ok 2 - promise abort signal | |||
| 113 | 117 | failureType: 'testAborted' | |
| 114 | 118 | error: 'This operation was aborted' | |
| 115 | 119 | code: 20 | |
| 120 | + name: 'AbortError' | ||
| 116 | 121 | stack: |- | |
| 117 | 122 | * | |
| 118 | 123 | * | |
@@ -168,6 +173,7 @@ not ok 2 - promise abort signal | |||
| 168 | 173 | failureType: 'testAborted' | |
| 169 | 174 | error: 'This operation was aborted' | |
| 170 | 175 | code: 20 | |
| 176 | + name: 'AbortError' | ||
| 171 | 177 | stack: |- | |
| 172 | 178 | * | |
| 173 | 179 | * | |
@@ -187,6 +193,7 @@ not ok 2 - promise abort signal | |||
| 187 | 193 | failureType: 'testAborted' | |
| 188 | 194 | error: 'This operation was aborted' | |
| 189 | 195 | code: 20 | |
| 196 | + name: 'AbortError' | ||
| 190 | 197 | stack: |- | |
| 191 | 198 | * | |
| 192 | 199 | * | |
@@ -206,6 +213,7 @@ not ok 2 - promise abort signal | |||
| 206 | 213 | failureType: 'testAborted' | |
| 207 | 214 | error: 'This operation was aborted' | |
| 208 | 215 | code: 20 | |
| 216 | + name: 'AbortError' | ||
| 209 | 217 | stack: |- | |
| 210 | 218 | * | |
| 211 | 219 | * | |
@@ -225,6 +233,7 @@ not ok 3 - callback timeout signal | |||
| 225 | 233 | failureType: 'testAborted' | |
| 226 | 234 | error: 'The operation was aborted due to timeout' | |
| 227 | 235 | code: 23 | |
| 236 | + name: 'TimeoutError' | ||
| 228 | 237 | stack: |- | |
| 229 | 238 | * | |
| 230 | 239 | * | |
@@ -238,6 +247,7 @@ not ok 4 - callback abort signal | |||
| 238 | 247 | failureType: 'testAborted' | |
| 239 | 248 | error: 'This operation was aborted' | |
| 240 | 249 | code: 20 | |
| 250 | + name: 'AbortError' | ||
| 241 | 251 | stack: |- | |
| 242 | 252 | * | |
| 243 | 253 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,6 +67,7 @@ not ok 1 - describe timeout signal | |||
| 67 | 67 | failureType: 'testAborted' | |
| 68 | 68 | error: 'The operation was aborted due to timeout' | |
| 69 | 69 | code: 23 | |
| 70 | + name: 'TimeoutError' | ||
| 70 | 71 | stack: |- | |
| 71 | 72 | * | |
| 72 | 73 | * | |
@@ -80,6 +81,7 @@ not ok 2 - describe abort signal | |||
| 80 | 81 | failureType: 'testAborted' | |
| 81 | 82 | error: 'This operation was aborted' | |
| 82 | 83 | code: 20 | |
| 84 | + name: 'AbortError' | ||
| 83 | 85 | stack: |- | |
| 84 | 86 | * | |
| 85 | 87 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,6 +122,7 @@ not ok 14 - async assertion fail | |||
| 122 | 122 | true !== false | |
| 123 | 123 | ||
| 124 | 124 | code: 'ERR_ASSERTION' | |
| 125 | + name: 'AssertionError' | ||
| 125 | 126 | expected: false | |
| 126 | 127 | actual: true | |
| 127 | 128 | operator: 'strictEqual' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,6 +126,7 @@ not ok 13 - async assertion fail | |||
| 126 | 126 | true !== false | |
| 127 | 127 | ||
| 128 | 128 | code: 'ERR_ASSERTION' | |
| 129 | + name: 'AssertionError' | ||
| 129 | 130 | expected: false | |
| 130 | 131 | actual: true | |
| 131 | 132 | operator: 'strictEqual' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,6 +126,7 @@ not ok 13 - async assertion fail | |||
| 126 | 126 | true !== false | |
| 127 | 127 | ||
| 128 | 128 | code: 'ERR_ASSERTION' | |
| 129 | + name: 'AssertionError' | ||
| 129 | 130 | expected: false | |
| 130 | 131 | actual: true | |
| 131 | 132 | operator: 'strictEqual' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments