import 'dart:convert'; import 'dart:io'; import 'package:test/test.dart'; void main() { test('check --format json --write-baseline keeps stdout pure JSON', () async { // The "wrote baseline" status line used to follow the JSON document on // stdout, so `pipe check --format json --write-baseline b.json | jq` failed. final temp = Directory.systemTemp.createTempSync('pipe-json-stdout'); final baseline = '${temp.path}/baseline.json'; final result = await Process.run(Platform.resolvedExecutable, [ 'bin/pipe.dart', 'check', 'test/fixtures/stuck_loading', '--format', 'json', '--write-baseline', baseline, '-c', '1', ]); expect(result.exitCode, 0, reason: '${result.stderr}'); expect(() => jsonDecode(result.stdout as String), returnsNormally); expect(result.stderr as String, contains('wrote baseline')); }); }