From 4191d347ff73a1c3f5754888bacfe0d1ad9766bc Mon Sep 17 00:00:00 2001 From: James Brunton Date: Mon, 3 Aug 2026 12:11:13 +0100 Subject: [PATCH] Fix Java tests not running headless on Mac (#7260) # Description of Changes The `task backend:test` command automatically spawns new Java processes in the dock on Mac as it runs, which takes the focus away from whatever the developer is doing at the time. This is because there's missing a missing `headless` tag in the `build.gradle` file (the tests don't spawn or require any windows, so they run fine headless). Also adds a `task backend:test:force` rule to run the tests without cache because the cache was getting in the way of testing this. image --- .taskfiles/backend.yml | 9 +++++++++ build.gradle | 2 ++ 2 files changed, 11 insertions(+) diff --git a/.taskfiles/backend.yml b/.taskfiles/backend.yml index dde75433a8..fbabd783a3 100644 --- a/.taskfiles/backend.yml +++ b/.taskfiles/backend.yml @@ -114,6 +114,15 @@ tasks: - cmd: ./gradlew test platforms: [linux, darwin] + test:force: + desc: "Run backend tests, ignoring cached results" + aliases: [test:no-cache] + cmds: + - cmd: cmd /c ".\gradlew.bat cleanTest test --no-build-cache" + platforms: [windows] + - cmd: ./gradlew cleanTest test --no-build-cache + platforms: [linux, darwin] + format: desc: "Auto-fix code formatting" cmds: diff --git a/build.gradle b/build.gradle index 5f29508958..28e20c9b15 100644 --- a/build.gradle +++ b/build.gradle @@ -292,6 +292,8 @@ subprojects { tasks.withType(Test).configureEach { useJUnitPlatform() + systemProperty 'java.awt.headless', 'true' + systemProperty 'apple.awt.UIElement', 'true' finalizedBy(jacocoReport) }