Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: lib/src/runner/loader.dart

Issue 1668573003: Add configuration support for choosing test paths. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: cr Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 8
9 import 'package:analyzer/analyzer.dart' hide Configuration; 9 import 'package:analyzer/analyzer.dart' hide Configuration;
10 import 'package:async/async.dart'; 10 import 'package:async/async.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 /// Creates a new loader that loads tests on platforms defined in [_config]. 56 /// Creates a new loader that loads tests on platforms defined in [_config].
57 /// 57 ///
58 /// [root] is the root directory that will be served for browser tests. It 58 /// [root] is the root directory that will be served for browser tests. It
59 /// defaults to the working directory. 59 /// defaults to the working directory.
60 Loader(this._config, {String root}) 60 Loader(this._config, {String root})
61 : _root = root == null ? p.current : root; 61 : _root = root == null ? p.current : root;
62 62
63 /// Loads all test suites in [dir]. 63 /// Loads all test suites in [dir].
64 /// 64 ///
65 /// This will load tests from files that end in "_test.dart". Any tests that 65 /// This will load tests from files that match the configuration's filename
66 /// fail to load will be emitted as [LoadException]s. 66 /// glob. Any tests that fail to load will be emitted as [LoadException]s.
67 /// 67 ///
68 /// This emits [LoadSuite]s that must then be run to emit the actual 68 /// This emits [LoadSuite]s that must then be run to emit the actual
69 /// [RunnerSuite]s defined in the file. 69 /// [RunnerSuite]s defined in the file.
70 Stream<LoadSuite> loadDir(String dir) { 70 Stream<LoadSuite> loadDir(String dir) {
71 return mergeStreams(new Directory(dir).listSync(recursive: true) 71 return mergeStreams(new Directory(dir).listSync(recursive: true)
72 .map((entry) { 72 .map((entry) {
73 if (entry is! File) return new Stream.fromIterable([]); 73 if (entry is! File) return new Stream.fromIterable([]);
74 74
75 if (!entry.path.endsWith("_test.dart")) { 75 if (!_config.filename.matches(p.basename(entry.path))) {
76 return new Stream.fromIterable([]); 76 return new Stream.fromIterable([]);
77 } 77 }
78 78
79 if (p.split(entry.path).contains('packages')) { 79 if (p.split(entry.path).contains('packages')) {
80 return new Stream.fromIterable([]); 80 return new Stream.fromIterable([]);
81 } 81 }
82 82
83 return loadFile(entry.path); 83 return loadFile(entry.path);
84 })); 84 }));
85 } 85 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 Future close() { 273 Future close() {
274 return _closeMemo.runOnce(() async { 274 return _closeMemo.runOnce(() async {
275 await Future.wait(_suites.map((suite) => suite.close())); 275 await Future.wait(_suites.map((suite) => suite.close()));
276 _suites.clear(); 276 _suites.clear();
277 277
278 if (!_browserServerMemo.hasRun) return; 278 if (!_browserServerMemo.hasRun) return;
279 await (await _browserServer).close(); 279 await (await _browserServer).close();
280 }); 280 });
281 } 281 }
282 } 282 }
OLDNEW
« no previous file with comments | « lib/src/runner/configuration/values.dart ('k') | test/runner/configuration/top_level_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698