sandbox top-level property

String sandbox

The sandbox directory in which descriptors are created and validated by default.

This is a temporary directory beneath Directory.systemTemp. A new one is created the first time sandbox is accessed for each test case, and automatically deleted after the test finishes running.

Implementation

String get sandbox {
  if (_sandbox != null) return _sandbox;
  // Resolve symlinks so we don't end up with inconsistent paths on Mac OS where
  // /tmp is symlinked.
  _sandbox = Directory.systemTemp
      .createTempSync('dart_test_')
      .resolveSymbolicLinksSync();

  addTearDown(() async {
    var sandbox = _sandbox;
    _sandbox = null;
    await Directory(sandbox).delete(recursive: true);
  });

  return _sandbox;
}