runCapture function

List<CapturedTest> runCapture(
  1. CaptureState state,
  2. void entryPoint()
)

Runs entryPoint under state, collecting every test(...) call made during execution into CaptureState.captured. Returns that list.

Implementation

List<CapturedTest> runCapture(
  CaptureState state,
  void Function() entryPoint,
) {
  final previous = _current;
  _current = state;
  try {
    entryPoint();
  } finally {
    _current = previous;
  }
  return state.captured;
}