Skip to content

Commit f6595aa

Browse files
committed
Add extra test assertion if we ever need to debug more flakiness in this test
1 parent db51904 commit f6595aa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tests/SwiftDocCUtilitiesTests/PreviewActionIntegrationTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,16 @@ class PreviewActionIntegrationTests: XCTestCase {
287287

288288
// This should only take 1.5 seconds (1 second for the directory monitor debounce and 0.5 seconds for the expectation poll interval)
289289
await fulfillment(of: [expectation], timeout: 20.0)
290+
// This assertion is always true if the expectation was fulfilled. However, in the past this expectation has sometimes (but very rarely) failed.
291+
// If that happens we want to print the full preview action log to help investigate what went wrong.
292+
XCTAssert(logStorage.text.contains("Conversion cancelled..."),
293+
"""
294+
PreviewAction log output doesn't contain 'Conversion cancelled...'.
295+
Full log output from the preview action that ran in this test (to investigate the issue):
296+
--------------------------------------------------
297+
\(logStorage.text)
298+
--------------------------------------------------
299+
""")
290300
}
291301

292302
#endif

0 commit comments

Comments
 (0)