import 'dart:io'; import 'package:pipe/src/cli.dart'; import 'package:pipe/src/errors.dart'; import 'package:test/test.dart'; void main() { test( 'an SDK the analyzer cannot read is a clean error, not a crash', () async { // A project whose package_config names a Flutter SDK that has since moved // left the analyzer unable to read the SDK's allowed_experiments.json. The // analyzer throws its own FileSystemException, which bin/pipe.dart's // dart:io catch never saw: exit 255 and a stack trace. final sdk = Directory.systemTemp.createTempSync('pipe-hollow-sdk'); addTearDown(() => sdk.deleteSync(recursive: true)); File('${sdk.path}/version').writeAsStringSync('3.13.0\n'); Directory('${sdk.path}/lib').createSync(); await expectLater( PipeRunner().run([ 'check', 'test/fixtures/stuck_loading', '--sdk', sdk.path, ]), throwsA( isA().having( (error) => error.remedy, 'remedy', contains('flutter pub get'), ), ), ); }, ); }