Skip to content

Commit 699459c

Browse files
committed
Add skeleton AdvancedConsoleOutputRecorder framework
- Add experimental AdvancedConsoleOutputRecorder activated via environment variable - Implement clean skeleton structure for incremental PR development - Fix terminal width hardcoding with 80-char safe fallback - Follow HumanReadableOutputRecorder delegation pattern - Update style guide compliance (80-char comment wrapping) - Re-enable AttachmentTests and disable slow demo test suites - Remove Foundation dependencies and signal handling - Prepare foundation for PR #1 (Skeleton), PR #2 (Hierarchy), PR #3 (Progress)
1 parent 042438f commit 699459c

File tree

10 files changed

+99
-1351
lines changed

10 files changed

+99
-1351
lines changed

Sources/Testing/ABI/EntryPoints/EntryPoint.swift

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,37 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
5252
configuration.verbosity = args.verbosity
5353

5454
if configuration.verbosity >= 0 {
55-
var advancedOptions = Event.AdvancedConsoleOutputRecorder.Options()
56-
advancedOptions.base = .for(FileHandle.stderr)
57-
58-
advancedOptions.base.useANSIEscapeCodes = true
59-
advancedOptions.base.ansiColorBitDepth = 24
60-
#if os(macOS)
61-
advancedOptions.base.useSFSymbols = true
62-
#endif
63-
64-
advancedOptions.useHierarchicalOutput = true
65-
66-
let eventRecorder = Event.AdvancedConsoleOutputRecorder(options: advancedOptions) { string in
67-
try? FileHandle.stderr.write(string)
68-
}
69-
70-
// Replace the event handler completely with our advanced recorder
71-
configuration.eventHandler = { event, context in
72-
eventRecorder.handle(event, in: context)
55+
// Check for experimental console output flag
56+
if Environment.flag(named: "SWT_ENABLE_EXPERIMENTAL_CONSOLE_OUTPUT") {
57+
var advancedOptions = Event.AdvancedConsoleOutputRecorder.Options()
58+
advancedOptions.base = .for(FileHandle.stderr)
59+
60+
advancedOptions.base.useANSIEscapeCodes = true
61+
advancedOptions.base.ansiColorBitDepth = 24
62+
#if os(macOS)
63+
advancedOptions.base.useSFSymbols = true
64+
#endif
65+
66+
advancedOptions.useHierarchicalOutput = true
67+
68+
let eventRecorder = Event.AdvancedConsoleOutputRecorder(options: advancedOptions) { string in
69+
try? FileHandle.stderr.write(string)
70+
}
71+
72+
// Replace the event handler completely with our advanced recorder
73+
configuration.eventHandler = { event, context in
74+
eventRecorder.handle(event, in: context)
75+
}
76+
} else {
77+
// Use the standard console output recorder
78+
let eventRecorder = Event.ConsoleOutputRecorder(options: .for(.stderr)) { string in
79+
try? FileHandle.stderr.write(string)
80+
}
81+
82+
configuration.eventHandler = { [oldEventHandler = configuration.eventHandler] event, context in
83+
oldEventHandler(event, context)
84+
eventRecorder.record(event, in: context)
85+
}
7386
}
7487
}
7588

0 commit comments

Comments
 (0)