@@ -97,6 +97,15 @@ class Configuration {
9797 /// See [shardIndex] for details.
9898 final int totalShards;
9999
100+ /// The list of packages to fold when producing [StackTrace] s.
101+ Set <String > get foldTraceExcept => _foldTraceExcept ?? new Set ();
102+ final Set <String > _foldTraceExcept;
103+
104+ /// If non-empty, all packages not in this list will be folded when producing
105+ /// [StackTrace] s.
106+ Set <String > get foldTraceOnly => _foldTraceOnly ?? new Set ();
107+ final Set <String > _foldTraceOnly;
108+
100109 /// The paths from which to load tests.
101110 List <String > get paths => _paths ?? ["test" ];
102111 final List <String > _paths;
@@ -198,6 +207,8 @@ class Configuration {
198207 int shardIndex,
199208 int totalShards,
200209 Iterable <String > paths,
210+ Iterable <String > foldTraceExcept,
211+ Iterable <String > foldTraceOnly,
201212 Glob filename,
202213 Iterable <String > chosenPresets,
203214 Map <String , Configuration > presets,
@@ -238,6 +249,8 @@ class Configuration {
238249 shardIndex: shardIndex,
239250 totalShards: totalShards,
240251 paths: paths,
252+ foldTraceExcept: foldTraceExcept,
253+ foldTraceOnly: foldTraceOnly,
241254 filename: filename,
242255 chosenPresets: chosenPresetSet,
243256 presets: _withChosenPresets (presets, chosenPresetSet),
@@ -290,6 +303,8 @@ class Configuration {
290303 this .shardIndex,
291304 this .totalShards,
292305 Iterable <String > paths,
306+ Iterable <String > foldTraceExcept,
307+ Iterable <String > foldTraceOnly,
293308 Glob filename,
294309 Iterable <String > chosenPresets,
295310 Map <String , Configuration > presets,
@@ -307,6 +322,8 @@ class Configuration {
307322 : Uri .parse ("http://localhost:$pubServePort " ),
308323 _concurrency = concurrency,
309324 _paths = _list (paths),
325+ _foldTraceExcept = _set (foldTraceExcept),
326+ _foldTraceOnly = _set (foldTraceOnly),
310327 _filename = filename,
311328 chosenPresets =
312329 new UnmodifiableSetView (chosenPresets? .toSet () ?? new Set ()),
@@ -347,6 +364,14 @@ class Configuration {
347364 return list;
348365 }
349366
367+ /// Returns a set from [input] .
368+ static Set <T > _set <T >(Iterable <T > input) {
369+ if (input == null ) return null ;
370+ var set = new Set <T >.from (input);
371+ if (set .isEmpty) return null ;
372+ return set ;
373+ }
374+
350375 /// Returns an unmodifiable copy of [input] or an empty unmodifiable map.
351376 static Map /*<K, V>*/ _map/*<K, V>*/ (Map /*<K, V>*/ input) {
352377 if (input == null || input.isEmpty) return const {};
@@ -369,6 +394,22 @@ class Configuration {
369394 if (this == Configuration .empty) return other;
370395 if (other == Configuration .empty) return this ;
371396
397+ var foldTraceOnly = other._foldTraceOnly ?? _foldTraceOnly;
398+ var foldTraceExcept = other._foldTraceExcept ?? _foldTraceExcept;
399+ if (_foldTraceOnly != null ) {
400+ if (other._foldTraceExcept != null ) {
401+ foldTraceOnly = _foldTraceOnly.difference (other._foldTraceExcept);
402+ } else if (other._foldTraceOnly != null ) {
403+ foldTraceOnly = other._foldTraceOnly.intersection (_foldTraceOnly);
404+ }
405+ } else if (_foldTraceExcept != null ) {
406+ if (other._foldTraceOnly != null ) {
407+ foldTraceOnly = other._foldTraceOnly.difference (_foldTraceExcept);
408+ } else if (other._foldTraceExcept != null ) {
409+ foldTraceExcept = other._foldTraceExcept.union (_foldTraceExcept);
410+ }
411+ }
412+
372413 var result = new Configuration ._(
373414 help: other._help ?? _help,
374415 version: other._version ?? _version,
@@ -382,6 +423,8 @@ class Configuration {
382423 shardIndex: other.shardIndex ?? shardIndex,
383424 totalShards: other.totalShards ?? totalShards,
384425 paths: other._paths ?? _paths,
426+ foldTraceExcept: foldTraceExcept,
427+ foldTraceOnly: foldTraceOnly,
385428 filename: other._filename ?? _filename,
386429 chosenPresets: chosenPresets.union (other.chosenPresets),
387430 presets: _mergeConfigMaps (presets, other.presets),
@@ -412,6 +455,8 @@ class Configuration {
412455 int shardIndex,
413456 int totalShards,
414457 Iterable <String > paths,
458+ Iterable <String > exceptPackages,
459+ Iterable <String > onlyPackages,
415460 Glob filename,
416461 Iterable <String > chosenPresets,
417462 Map <String , Configuration > presets,
@@ -450,6 +495,8 @@ class Configuration {
450495 shardIndex: shardIndex ?? this .shardIndex,
451496 totalShards: totalShards ?? this .totalShards,
452497 paths: paths ?? _paths,
498+ foldTraceExcept: exceptPackages ?? _foldTraceExcept,
499+ foldTraceOnly: onlyPackages ?? _foldTraceOnly,
453500 filename: filename ?? _filename,
454501 chosenPresets: chosenPresets ?? this .chosenPresets,
455502 presets: presets ?? this .presets,
0 commit comments