It does seem that if a local package can be edited, it should be testable too.
My workaround is to use a custom behaviour in Xcode to run a script via a shortcut. (Xcode>behaviors>edit behaviors)
I'm using osascript to display text using the following bash script which is totally AI generated (Gemini)
#!/bin/bash
# Create a temporary file
temp_file=$(mktemp /tmp/swift_test_output.XXXXXX)
# Run swift test and redirect output
cd /Users/will/songket/FontUI
swift test > "$temp_file" 2>&1
# Check the exit code of swift test.
testResult=$?
# Read the output from the temporary file
output=$(cat "$temp_file")
# Clean up the temporary file
rm "$temp_file"
# Format the output for display.
if [[ "$testResult" -ne 0 ]]; then
message="Swift tests failed:\n$output"
else
message="Swift tests completed:\n$output"
fi
# Display the output in a dialog box
osascript -e "display dialog \"$message\""
exit $testResult`