Commit a433759
test_runner: show interrupted test on SIGINT
When the test runner process is killed with SIGINT (Ctrl+C), display
which test was running at the time of interruption. This makes it
easier to identify tests that hang or take too long.
- Add `test:interrupted` event emitted when SIGINT is received
- Add `interrupted()` method to TestsStream
- Handle the event in both TAP and spec reporters
- TAP outputs: `# Interrupted while running: <test>`
- Spec outputs with yellow header and warning symbol
- Use setImmediate to allow reporter stream to flush before exit
With process isolation (default), shows the file path since the
parent runner only knows about file-level tests.
With --test-isolation=none, shows the actual test name.
PR-URL: #61676
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>1 parent b0a79b1 commit a433759Copy full SHA for a433759
6 files changed
+104-4Lines changed: 104 additions & 4 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- doc/api
- lib/internal/test_runner
- reporter
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+26Lines changed: 26 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3348 | 3348 | |
3349 | 3349 | |
3350 | 3350 | |
| 3351 | + |
| 3352 | + |
| 3353 | + |
| 3354 | + |
| 3355 | + |
| 3356 | + |
| 3357 | + |
| 3358 | + |
| 3359 | + |
| 3360 | + |
| 3361 | + |
| 3362 | + |
| 3363 | + |
| 3364 | + |
| 3365 | + |
| 3366 | + |
| 3367 | + |
| 3368 | + |
| 3369 | + |
| 3370 | + |
| 3371 | + |
| 3372 | + |
| 3373 | + |
| 3374 | + |
| 3375 | + |
| 3376 | + |
3351 | 3377 | |
3352 | 3378 | |
3353 | 3379 | |
|
Collapse file
lib/internal/test_runner/harness.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/harness.js+28-1Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
| 6 | + |
6 | 7 | |
7 | 8 | |
8 | 9 | |
| ||
32 | 33 | |
33 | 34 | |
34 | 35 | |
35 | | - |
| 36 | + |
36 | 37 | |
37 | 38 | |
38 | 39 | |
| ||
289 | 290 | |
290 | 291 | |
291 | 292 | |
| 293 | + |
| 294 | + |
| 295 | + |
| 296 | + |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
292 | 313 | |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
293 | 320 | |
294 | 321 | |
295 | 322 | |
|
Collapse file
lib/internal/test_runner/reporter/spec.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/spec.js+23Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
106 | 106 | |
107 | 107 | |
108 | 108 | |
| 109 | + |
| 110 | + |
109 | 111 | |
110 | 112 | |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
111 | 134 | |
112 | 135 | |
113 | 136 | |
|
Collapse file
lib/internal/test_runner/reporter/tap.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/tap.js+10Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
64 | 74 | |
65 | 75 | |
66 | 76 | |
|
Collapse file
lib/internal/test_runner/tests_stream.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/tests_stream.js+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
149 | 149 | |
150 | 150 | |
151 | 151 | |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
152 | 159 | |
153 | 160 | |
154 | 161 | |
|
Collapse file
test/parallel/test-runner-exit-code.js
Copy file name to clipboardExpand all lines: test/parallel/test-runner-exit-code.js+10-3Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | | - |
| 9 | + |
10 | 10 | |
11 | 11 | |
12 | 12 | |
| ||
21 | 21 | |
22 | 22 | |
23 | 23 | |
| 24 | + |
| 25 | + |
| 26 | + |
24 | 27 | |
25 | 28 | |
26 | 29 | |
| ||
67 | 70 | |
68 | 71 | |
69 | 72 | |
70 | | - |
71 | | - |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
72 | 79 | |
0 commit comments