evaluatePrecondition method

Future<Precondition> evaluatePrecondition(
  1. Precondition p, {
  2. bool ignoreCache = false,
})

Runs single precondition test. If the test is already running it won't be started again and you will receive the result of already running evaluation. If the test has dependencies, they will be evaluated first. If they fail, your test won't be run at all and it's result will be PreconditionStatus.Failed().

The registerPrecondition.staySatisfiedCacheDuration and registerPrecondition.stayFailedCacheDuration can also influence whether the precondition will be actually run or not.

Use ignoreCache = true to omit any cached value

Implementation

Future<Precondition> evaluatePrecondition(Precondition p, {bool ignoreCache = false}) async {
  _log.info("Evaluating $p");
  try {
    await _semaphore.acquire();
    notifyListeners();
    _Runner _context = _Runner();
    var result = await _context.run(p, ignoreCache);
    await _context.waitForFinish();
    return result;
  } finally {
    _semaphore.release();
    notifyListeners();
  }
}