Skip to content

Commit

Permalink
Emit warning when running itest in non-headless mode
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Haller <[email protected]>
  • Loading branch information
mhoff12358 and Bromeon committed Nov 19, 2023
1 parent abc2a14 commit 1be971e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions itest/godot/TestRunner.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

@tool # To ensure that itest is not run from the editor; see below.

extends Node
class_name GDScriptTestRunner

func _ready():
# Check that tests are invoked from the command line. Loading the editor may break some parts (e.g. generated test code).
# Both checks are needed (it's possible to invoke `godot -e --headless`).
if Engine.is_editor_hint() || DisplayServer.get_name() != 'headless':
push_error("Integration tests must be run in headless mode (without editor).")
get_tree().quit(2)
return

# Ensure physics is initialized, for tests that require it.
await get_tree().physics_frame

Expand Down

0 comments on commit 1be971e

Please sign in to comment.