At this stage, the only possible way to check if your application is running in the AppBuilder Companion apps or as an application package is to check if certain custom Cordova plugin is initialized. For example, let's say you have the AdMob
plugin in the project. Then, you could have the following check:
// Debug in simulator
else if (!window.navigator.simulator && typeof window.plugins.AdMob === "undefined")
// System Testing
However, the above approach is more a hack than an actual solution, as there are situations in which the plugin won't be initialized even in production environment. That's why I do not recommend it. Still, this is the only possible way I can think of at the moment.
Further, I think that the idea of having a way to distinguish whether the app runs in the AppBuilder Companion apps or it is deployed as an application package is very good. So, i have logged it in our backlog for future implementation. I believe it could be ready for the next official release of AppBuilder.
I hope this helps.