@@ -413,10 +413,24 @@ void main() {
413
413
+2: All tests passed!''' , args: ['--run-skipped' ]);
414
414
});
415
415
});
416
+
417
+ test ('Directs users to enable stack trace chaining if disabled' , () async {
418
+ await _expectReport (
419
+ '''test('failure 1', () => throw TestFailure('oh no'));''' , '''
420
+ +0: loading test.dart
421
+ +0: failure 1
422
+ +0 -1: failure 1 [E]
423
+ oh no
424
+ test.dart 6:25 main.<fn>
425
+ +0 -1: Some tests failed.
426
+ Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
427
+ For example, 'dart test --chain-stack-traces'.''' ,
428
+ chainStackTraces: false );
429
+ });
416
430
}
417
431
418
432
Future <void > _expectReport (String tests, String expected,
419
- {List <String > args = const []}) async {
433
+ {List <String > args = const [], bool chainStackTraces = true }) async {
420
434
await d.file ('test.dart' , '''
421
435
import 'dart:async';
422
436
@@ -427,8 +441,11 @@ $tests
427
441
}
428
442
''' ).create ();
429
443
430
- var test = await runTest (['test.dart' , '--chain-stack-traces' , ...args],
431
- reporter: 'compact' );
444
+ var test = await runTest ([
445
+ 'test.dart' ,
446
+ if (chainStackTraces) '--chain-stack-traces' ,
447
+ ...args,
448
+ ], reporter: 'compact' );
432
449
await test.shouldExit ();
433
450
434
451
var stdoutLines = await test.stdout.rest.toList ();
0 commit comments