Skip to content

Commit fef7927

Browse files
authored
test: deflake test-runner-output
PR-URL: #49878 Fixes: #49853 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
1 parent 6754652 commit fef7927

8 files changed

+22
-25
lines changed

test/fixtures/test-runner/output/abort.snapshot

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TAP version 13
3232
# Subtest: not ok 2
3333
not ok 6 - not ok 2
3434
---
35-
duration_ms: ZERO
35+
duration_ms: *
3636
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
3737
failureType: 'cancelledByParent'
3838
error: 'test did not finish before its parent and was cancelled'
@@ -41,7 +41,7 @@ TAP version 13
4141
# Subtest: not ok 3
4242
not ok 7 - not ok 3
4343
---
44-
duration_ms: ZERO
44+
duration_ms: *
4545
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
4646
failureType: 'testAborted'
4747
error: 'This operation was aborted'
@@ -62,7 +62,7 @@ TAP version 13
6262
# Subtest: not ok 4
6363
not ok 8 - not ok 4
6464
---
65-
duration_ms: ZERO
65+
duration_ms: *
6666
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
6767
failureType: 'testAborted'
6868
error: 'This operation was aborted'
@@ -83,7 +83,7 @@ TAP version 13
8383
# Subtest: not ok 5
8484
not ok 9 - not ok 5
8585
---
86-
duration_ms: ZERO
86+
duration_ms: *
8787
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
8888
failureType: 'testAborted'
8989
error: 'This operation was aborted'
@@ -169,7 +169,7 @@ not ok 2 - promise abort signal
169169
# Subtest: not ok 2
170170
not ok 6 - not ok 2
171171
---
172-
duration_ms: ZERO
172+
duration_ms: *
173173
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
174174
failureType: 'cancelledByParent'
175175
error: 'test did not finish before its parent and was cancelled'
@@ -178,7 +178,7 @@ not ok 2 - promise abort signal
178178
# Subtest: not ok 3
179179
not ok 7 - not ok 3
180180
---
181-
duration_ms: ZERO
181+
duration_ms: *
182182
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
183183
failureType: 'testAborted'
184184
error: 'This operation was aborted'
@@ -199,7 +199,7 @@ not ok 2 - promise abort signal
199199
# Subtest: not ok 4
200200
not ok 8 - not ok 4
201201
---
202-
duration_ms: ZERO
202+
duration_ms: *
203203
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
204204
failureType: 'testAborted'
205205
error: 'This operation was aborted'
@@ -220,7 +220,7 @@ not ok 2 - promise abort signal
220220
# Subtest: not ok 5
221221
not ok 9 - not ok 5
222222
---
223-
duration_ms: ZERO
223+
duration_ms: *
224224
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
225225
failureType: 'testAborted'
226226
error: 'This operation was aborted'

test/fixtures/test-runner/output/abort_hooks.snapshot

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TAP version 13
1111
# Subtest: test 1
1212
not ok 1 - test 1
1313
---
14-
duration_ms: ZERO
14+
duration_ms: *
1515
location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3'
1616
failureType: 'cancelledByParent'
1717
error: 'test did not finish before its parent and was cancelled'
@@ -20,7 +20,7 @@ TAP version 13
2020
# Subtest: test 2
2121
not ok 2 - test 2
2222
---
23-
duration_ms: ZERO
23+
duration_ms: *
2424
location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3'
2525
failureType: 'cancelledByParent'
2626
error: 'test did not finish before its parent and was cancelled'

test/fixtures/test-runner/output/abort_suite.snapshot

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TAP version 13
3232
# Subtest: not ok 2
3333
not ok 6 - not ok 2
3434
---
35-
duration_ms: ZERO
35+
duration_ms: *
3636
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
3737
failureType: 'cancelledByParent'
3838
error: 'test did not finish before its parent and was cancelled'
@@ -41,7 +41,7 @@ TAP version 13
4141
# Subtest: not ok 3
4242
not ok 7 - not ok 3
4343
---
44-
duration_ms: ZERO
44+
duration_ms: *
4545
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
4646
failureType: 'testAborted'
4747
error: 'This operation was aborted'
@@ -62,7 +62,7 @@ TAP version 13
6262
# Subtest: not ok 4
6363
not ok 8 - not ok 4
6464
---
65-
duration_ms: ZERO
65+
duration_ms: *
6666
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
6767
failureType: 'testAborted'
6868
error: 'This operation was aborted'
@@ -83,7 +83,7 @@ TAP version 13
8383
# Subtest: not ok 5
8484
not ok 9 - not ok 5
8585
---
86-
duration_ms: ZERO
86+
duration_ms: *
8787
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
8888
failureType: 'testAborted'
8989
error: 'This operation was aborted'

test/fixtures/test-runner/output/arbitrary-output.snapshot

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
TAP version 13
22
ok 1 - test
33
---
4-
duration_ms: ZERO
4+
duration_ms: *
55
...
66
# arbitrary - pre
77
ok 2 - test
88
---
9-
duration_ms: ZERO
9+
duration_ms: *
1010
...
1111
# arbitrary - mid
1212
ok 3 - test
1313
---
14-
duration_ms: ZERO
14+
duration_ms: *
1515
...
1616
# arbitrary - post
1717
1..3

test/fixtures/test-runner/output/describe_it.snapshot

+2-2
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ not ok 51 - subtest sync throw fails
513513
# Subtest: should not run
514514
not ok 1 - should not run
515515
---
516-
duration_ms: ZERO
516+
duration_ms: *
517517
location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3'
518518
failureType: 'cancelledByParent'
519519
error: 'test did not finish before its parent and was cancelled'
@@ -544,7 +544,7 @@ not ok 52 - describe sync throw fails
544544
# Subtest: should not run
545545
not ok 1 - should not run
546546
---
547-
duration_ms: ZERO
547+
duration_ms: *
548548
location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3'
549549
failureType: 'cancelledByParent'
550550
error: 'test did not finish before its parent and was cancelled'

test/fixtures/test-runner/output/hooks.snapshot

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ok 1 - describe hooks
3737
# Subtest: 1
3838
not ok 1 - 1
3939
---
40-
duration_ms: ZERO
40+
duration_ms: *
4141
location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3'
4242
failureType: 'cancelledByParent'
4343
error: 'test did not finish before its parent and was cancelled'
@@ -46,7 +46,7 @@ ok 1 - describe hooks
4646
# Subtest: 2
4747
not ok 2 - 2
4848
---
49-
duration_ms: ZERO
49+
duration_ms: *
5050
location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3'
5151
failureType: 'cancelledByParent'
5252
error: 'test did not finish before its parent and was cancelled'

test/fixtures/test-runner/output/unresolved_promise.snapshot

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ not ok 2 - never resolving promise
1818
# Subtest: fail
1919
not ok 3 - fail
2020
---
21-
duration_ms: ZERO
21+
duration_ms: *
2222
location: '/test/fixtures/test-runner/output/unresolved_promise.js:(LINE):1'
2323
failureType: 'cancelledByParent'
2424
error: 'Promise resolution is still pending but the event loop has already resolved'

test/parallel/test-runner-output.mjs

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const skipForceColors =
1010

1111
function replaceTestDuration(str) {
1212
return str
13-
.replaceAll(/duration_ms: 0(\r?\n)/g, 'duration_ms: ZERO$1')
1413
.replaceAll(/duration_ms: [0-9.]+/g, 'duration_ms: *')
1514
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *');
1615
}
@@ -20,15 +19,13 @@ const stackTraceBasePath = new RegExp(`${color}\\(${process.cwd()}/?${color}(.*)
2019

2120
function replaceSpecDuration(str) {
2221
return str
23-
.replaceAll(/\(0(\r?\n)ms\)/g, '(ZEROms)')
2422
.replaceAll(/[0-9.]+ms/g, '*ms')
2523
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
2624
.replace(stackTraceBasePath, '$3');
2725
}
2826

2927
function replaceJunitDuration(str) {
3028
return str
31-
.replaceAll(/time="0"/g, 'time="ZERO"')
3229
.replaceAll(/time="[0-9.]+"/g, 'time="*"')
3330
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
3431
.replaceAll(hostname(), 'HOSTNAME')

0 commit comments

Comments
 (0)