Commit 3c2da34
authored
fix(github): tolerate test:fail events without a details.error (#175)
Node can emit `test:fail` where `details.error` is null — for example when
a hook re-run resets `this.error` before reporting (see
`lib/internal/test_runner/test.js`). The previous code dereferenced
`error.code` unconditionally on line 90, throwing
`TypeError: Cannot read properties of null (reading 'code')`.
Because `transformEvent` runs inside a Transform stream (`SpecReporter._transform`),
the synchronous throw surfaces as an unhandled `'error'` event on the stream,
which crashes the whole `node --test` process. Any reporters wired alongside
it (including the internal `rerun` reporter used by `--test-rerun-failures`)
lose their chance to flush, leaving truncated output files.
Skip annotation when there is no error object, matching the existing behavior
for `subtestsFailed` wrappers.1 parent 5637d57 commit 3c2da34
2 files changed
Lines changed: 31 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
49 | 77 | | |
0 commit comments