diff --git a/webdev/test/e2e_test.dart b/webdev/test/e2e_test.dart index 2b6760256..066c62cda 100644 --- a/webdev/test/e2e_test.dart +++ b/webdev/test/e2e_test.dart @@ -39,6 +39,26 @@ void main() { await d.file('pubspec.lock', isNotEmpty).validate(exampleDirectory); }); + test('build should fail if targetting an existing directory', () async { + await d.file('simple thing', 'throw-away').create(); + + var args = ['build', '-o', 'web:${d.sandbox}']; + + var process = await runWebDev(args, workingDirectory: exampleDirectory); + + // NOTE: We'd like this to be more useful + // See https://github.com/dart-lang/build/issues/1283 + + await expectLater( + process.stdout, + emitsThrough( + '[WARNING] Skipped creation of the merged output directory.')); + await expectLater(process.stderr, + emitsThrough('Failed to create merged output directories.')); + + await process.shouldExit(1); + }); + group('should build with valid configuration', () { for (var withDDC in [true, false]) { test(withDDC ? 'DDC' : 'dart2js', () async { @@ -50,10 +70,6 @@ void main() { var process = await runWebDev(args, workingDirectory: exampleDirectory); var expectedItems = ['[INFO] Succeeded']; - if (!withDDC) { - expectedItems.add(anyOf( - contains('with 0 outputs'), contains('Running dart2js with'))); - } await checkProcessStdout(process, expectedItems); await process.shouldExit(0); diff --git a/webdev/test/integration_test.dart b/webdev/test/integration_test.dart index 8e2411822..2ec64c6e0 100644 --- a/webdev/test/integration_test.dart +++ b/webdev/test/integration_test.dart @@ -42,8 +42,8 @@ name: sample var process = await runWebDev([command], workingDirectory: d.sandbox); await checkProcessStdout(process, [ - r'''webdev could not run for this project. -You must have a dependency on `build_runner` in `pubspec.yaml`.''' + 'webdev could not run for this project.', + 'You must have a dependency on `build_runner` in `pubspec.yaml`.' ]); await process.shouldExit(78); }); @@ -63,8 +63,8 @@ name: sample var process = await runWebDev(['serve'], workingDirectory: d.sandbox); await checkProcessStdout(process, [ - r'''webdev could not run for this project. -You must have a dependency on `build_web_compilers` in `pubspec.yaml`.''' + 'webdev could not run for this project.', + 'You must have a dependency on `build_web_compilers` in `pubspec.yaml`.' ]); await process.shouldExit(78); }); diff --git a/webdev/test/test_utils.dart b/webdev/test/test_utils.dart index be1628f4f..46b286f56 100644 --- a/webdev/test/test_utils.dart +++ b/webdev/test/test_utils.dart @@ -19,11 +19,11 @@ Future runWebDev(List args, {String workingDirectory}) { } Future checkProcessStdout(TestProcess process, List items) async { - var output = await process.stdoutStream().join('\n'); for (var item in items) { if (item is! Matcher) { item = contains(item); } - expect(output, item); + + await expectLater(process.stdout, emitsThrough(item)); } }