To include tests.collection (or anything else) in the bundle without referencing it somewhere, you can declare it as a custom resource in game.project, in the “Project” category.
Are you bundling the game every time you make a change to it, maybe because you want to test it without Defold’s profiler and all? Or do you want to test different collections without changing the value in the game.project file because you might forget to change it back?
My approach is to have two collection proxies in main.collection and use a script to determine which collection is played. It would look like this. It follows the “loader” pattern described in the Collection Proxy manual.
go.property('play_debug_collection', false)
function init(self)
if sys.get_engine_info().is_debug and self.play_debug_collection then
msg.post('#tests', 'load')
else
msg.post('#start game', 'load')
end
end
function on_message(self, message_id, message, sender)
if message_id == hash('proxy_loaded') then
msg.post(sender, 'init')
msg.post(sender, 'enable')
end
end
Then the file path and toggle belong to main.collection instead of in game.project, and the debug collection won’t be accidentally loaded in a release build.