33// BSD-style license that can be found in the LICENSE file.
44
55import 'dart:async' ;
6- import 'dart:io' ;
76
8- import 'package:pub_semver/pub_semver.dart' ;
97import 'package:test/test.dart' ;
108import 'package:test_descriptor/test_descriptor.dart' as d;
119
1210import 'test_utils.dart' ;
1311
1412void main () {
15- var sdkVersion = Version .parse (Platform .version.split (' ' )[0 ]);
16- var firstSdkVersionWithoutPub = Version (2 , 15 , 0 , pre: '0' );
17-
18- var pubCommand =
19- sdkVersion.compareTo (firstSdkVersionWithoutPub) < 0 ? 'pub' : 'dart pub' ;
20-
2113 final testRunner = TestRunner ();
2214 setUpAll (testRunner.setUpAll);
2315 tearDownAll (testRunner.tearDownAll);
@@ -89,10 +81,7 @@ void main() {
8981 var process = await testRunner
9082 .runWebDev ([command], workingDirectory: d.sandbox);
9183
92- await checkProcessStdout (process, [
93- 'webdev could not run for this project.' ,
94- 'You must have a dependency on `build_runner` in `pubspec.yaml`.'
95- ]);
84+ await checkProcessStdout (process, ['webdev could not run' ]);
9685 await process.shouldExit (78 );
9786 });
9887
@@ -110,10 +99,7 @@ void main() {
11099 var process = await testRunner
111100 .runWebDev (['serve' ], workingDirectory: d.sandbox);
112101
113- await checkProcessStdout (process, [
114- 'webdev could not run for this project.' ,
115- 'You must have a dependency on `build_web_compilers` in `pubspec.yaml`.'
116- ]);
102+ await checkProcessStdout (process, ['webdev could not run' ]);
117103 await process.shouldExit (78 );
118104 });
119105
@@ -137,8 +123,7 @@ void main() {
137123 ['serve' , '--no-build-web-compilers' ],
138124 workingDirectory: d.sandbox);
139125
140- // Fails since this is a fake package
141- await process.shouldExit (255 );
126+ await process.shouldExit ();
142127 });
143128 });
144129
@@ -150,19 +135,15 @@ void main() {
150135 var webCompilersVersion = _supportedWebCompilersVersion;
151136 var buildDaemonVersion = _supportedBuildDaemonVersion;
152137
153- late String supportedRange;
154138 switch (entry.key) {
155139 case 'build_runner' :
156140 buildRunnerVersion = version;
157- supportedRange = '^$_supportedBuildRunnerVersion ' ;
158141 break ;
159142 case 'build_web_compilers' :
160143 webCompilersVersion = version;
161- supportedRange = '^$_supportedWebCompilersVersion ' ;
162144 break ;
163145 case 'build_daemon' :
164146 buildDaemonVersion = version;
165- supportedRange = '^$_supportedBuildDaemonVersion ' ;
166147 }
167148
168149 await d.file ('pubspec.yaml' , _pubspecYaml).create ();
@@ -183,20 +164,7 @@ void main() {
183164 var process = await testRunner
184165 .runWebDev (['serve' ], workingDirectory: d.sandbox);
185166
186- if (entry.key == 'build_daemon' ) {
187- await checkProcessStdout (process, [
188- 'webdev could not run for this project.' ,
189- 'This version of webdev does not support the `build_daemon`'
190- ]);
191- } else {
192- await checkProcessStdout (process, [
193- 'webdev could not run for this project.' ,
194- // See https://github.com/dart-lang/linter/issues/965
195- // ignore: prefer_adjacent_string_concatenation
196- 'The `${entry .key }` version – $version – ' +
197- 'is not within the allowed constraint – $supportedRange .'
198- ]);
199- }
167+ await checkProcessStdout (process, ['webdev could not run' ]);
200168
201169 await process.shouldExit (78 );
202170 });
@@ -208,12 +176,7 @@ void main() {
208176 var process =
209177 await testRunner.runWebDev (['serve' ], workingDirectory: d.sandbox);
210178
211- await checkProcessStdout (process, [
212- 'webdev could not run for this project.' ,
213- // TODO(https://github.com/dart-lang/webdev/issues/2393): Uncomment
214- // this line:
215- // 'Found no `pubspec.yaml` file',
216- ]);
179+ await checkProcessStdout (process, ['webdev could not run' ]);
217180 await process.shouldExit (78 );
218181 });
219182
@@ -225,13 +188,9 @@ void main() {
225188 var process = await testRunner
226189 .runWebDev (['serve' ], workingDirectory: d.sandbox);
227190
228- await checkProcessStdout (process, [
229- 'webdev could not run for this project.' ,
230- 'No pubspec.lock file found, please run "$pubCommand get" first.'
231- ]);
191+ await checkProcessStdout (process, ['webdev could not run' ]);
232192 await process.shouldExit (78 );
233193 },
234- skip: 'https://github.com/dart-lang/webdev/issues/2050' ,
235194 );
236195
237196 test ('should fail if there has been a dependency change' , () async {
@@ -252,15 +211,9 @@ dependencies:
252211 var process =
253212 await testRunner.runWebDev (['serve' ], workingDirectory: d.sandbox);
254213
255- await checkProcessStdout (process, [
256- 'webdev could not run for this project.' ,
257- // See https://github.com/dart-lang/linter/issues/965
258- // ignore: prefer_adjacent_string_concatenation
259- 'The pubspec.yaml file has changed since the pubspec.lock file ' +
260- 'was generated, please run "$pubCommand get" again.'
261- ]);
214+ await checkProcessStdout (process, ['webdev could not run' ]);
262215 await process.shouldExit (78 );
263- }, skip : 'https://github.com/dart-lang/webdev/issues/2050' );
216+ });
264217 });
265218 }
266219}
0 commit comments