isTesting property
bool
get
isTesting
True when APP_ENV=testing is a real environment variable, or the
code runs under dart test.
Implementation
static bool get isTesting {
if (Platform.environment['APP_ENV'] == 'testing') return true;
// ponytail: `dart test` runs a bootstrap from a `dart_test.*` temp
// folder. Use APP_ENV=testing if a test runner ever changes this.
String script = Platform.script.path;
return script.contains('/dart_test.') || script.endsWith('_test.dart');
}