Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: deflake test-runner-output #49878

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/fixtures/test-runner/output/abort.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TAP version 13
# Subtest: not ok 2
not ok 6 - not ok 2
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand All @@ -41,7 +41,7 @@ TAP version 13
# Subtest: not ok 3
not ok 7 - not ok 3
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -62,7 +62,7 @@ TAP version 13
# Subtest: not ok 4
not ok 8 - not ok 4
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -83,7 +83,7 @@ TAP version 13
# Subtest: not ok 5
not ok 9 - not ok 5
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):7'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand Down Expand Up @@ -169,7 +169,7 @@ not ok 2 - promise abort signal
# Subtest: not ok 2
not ok 6 - not ok 2
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand All @@ -178,7 +178,7 @@ not ok 2 - promise abort signal
# Subtest: not ok 3
not ok 7 - not ok 3
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -199,7 +199,7 @@ not ok 2 - promise abort signal
# Subtest: not ok 4
not ok 8 - not ok 4
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -220,7 +220,7 @@ not ok 2 - promise abort signal
# Subtest: not ok 5
not ok 9 - not ok 5
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort.js:(LINE):5'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/test-runner/output/abort_hooks.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TAP version 13
# Subtest: test 1
not ok 1 - test 1
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand All @@ -20,7 +20,7 @@ TAP version 13
# Subtest: test 2
not ok 2 - test 2
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/test-runner/output/abort_suite.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TAP version 13
# Subtest: not ok 2
not ok 6 - not ok 2
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand All @@ -41,7 +41,7 @@ TAP version 13
# Subtest: not ok 3
not ok 7 - not ok 3
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -62,7 +62,7 @@ TAP version 13
# Subtest: not ok 4
not ok 8 - not ok 4
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand All @@ -83,7 +83,7 @@ TAP version 13
# Subtest: not ok 5
not ok 9 - not ok 5
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3'
failureType: 'testAborted'
error: 'This operation was aborted'
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/test-runner/output/arbitrary-output.snapshot
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
TAP version 13
ok 1 - test
---
duration_ms: ZERO
duration_ms: *
...
# arbitrary - pre
ok 2 - test
---
duration_ms: ZERO
duration_ms: *
...
# arbitrary - mid
ok 3 - test
---
duration_ms: ZERO
duration_ms: *
...
# arbitrary - post
1..3
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/test-runner/output/describe_it.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ not ok 51 - subtest sync throw fails
# Subtest: should not run
not ok 1 - should not run
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand Down Expand Up @@ -544,7 +544,7 @@ not ok 52 - describe sync throw fails
# Subtest: should not run
not ok 1 - should not run
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/test-runner/output/hooks.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ok 1 - describe hooks
# Subtest: 1
not ok 1 - 1
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand All @@ -46,7 +46,7 @@ ok 1 - describe hooks
# Subtest: 2
not ok 2 - 2
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/hooks.js:(LINE):3'
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ not ok 2 - never resolving promise
# Subtest: fail
not ok 3 - fail
---
duration_ms: ZERO
duration_ms: *
location: '/test/fixtures/test-runner/output/unresolved_promise.js:(LINE):1'
failureType: 'cancelledByParent'
error: 'Promise resolution is still pending but the event loop has already resolved'
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const skipForceColors =

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

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

function replaceJunitDuration(str) {
return str
.replaceAll(/time="0"/g, 'time="ZERO"')
.replaceAll(/time="[0-9.]+"/g, 'time="*"')
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
.replaceAll(hostname(), 'HOSTNAME')
Expand Down