runningFromTest top-level property
Whether the current process is a pub subprocess being run from a test.
The "_PUB_TESTING" variable is automatically set for all the test code's invocations of pub.
Implementation
final bool runningFromTest = env.exists('_PUB_TESTING') && _assertionsEnabled;