| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Dart2js can take a long time to compile dart code, so we increase the timeout | 5 // Dart2js can take a long time to compile dart code, so we increase the timeout |
| 6 // to cope with that. | 6 // to cope with that. |
| 7 @Timeout.factor(3) | 7 @Timeout.factor(3) |
| 8 | 8 |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:pub/src/exit_codes.dart' as exit_codes; | 10 import 'package:pub/src/exit_codes.dart' as exit_codes; |
| 11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
| 12 import 'package:scheduled_test/scheduled_stream.dart'; | 12 import 'package:scheduled_test/scheduled_stream.dart'; |
| 13 | 13 |
| 14 import '../descriptor.dart' as d; | 14 import '../descriptor.dart' as d; |
| 15 import '../test_pub.dart'; | 15 import '../test_pub.dart'; |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 integration("reports Dart parse errors", () { | 18 integration("reports Dart parse errors", () { |
| 19 d.dir(appPath, [ | 19 d.dir(appPath, [ |
| 20 d.appPubspec(), | 20 d.appPubspec(), |
| 21 d.dir('web', [ | 21 d.dir('web', [ |
| 22 d.file('file.txt', 'contents'), | 22 d.file('file.txt', 'contents'), |
| 23 d.file('file.dart', 'void void;'), | 23 d.file('file.dart', 'void void;'), |
| 24 d.dir('subdir', [ | 24 d.dir('subdir', [ |
| 25 d.file('subfile.dart', 'void void;') | 25 d.file('subfile.dart', 'void void;') |
| 26 ]) | 26 ]) |
| 27 ]) | 27 ]) |
| 28 ]).create(); | 28 ]).create(); |
| 29 | 29 |
| 30 pubGet(); |
| 30 var pub = startPub(args: ["build"]); | 31 var pub = startPub(args: ["build"]); |
| 31 pub.stdout.expect(startsWith("Loading source assets...")); | 32 pub.stdout.expect(startsWith("Loading source assets...")); |
| 32 pub.stdout.expect(startsWith("Building myapp...")); | 33 pub.stdout.expect(startsWith("Building myapp...")); |
| 33 | 34 |
| 34 var consumeFile = consumeThrough(inOrder([ | 35 var consumeFile = consumeThrough(inOrder([ |
| 35 "[Error from Dart2JS]:", | 36 "[Error from Dart2JS]:", |
| 36 startsWith(p.join("web", "file.dart") + ":") | 37 startsWith(p.join("web", "file.dart") + ":") |
| 37 ])); | 38 ])); |
| 38 var consumeSubfile = consumeThrough(inOrder([ | 39 var consumeSubfile = consumeThrough(inOrder([ |
| 39 "[Error from Dart2JS]:", | 40 "[Error from Dart2JS]:", |
| 40 startsWith(p.join("web", "subdir", "subfile.dart") + ":") | 41 startsWith(p.join("web", "subdir", "subfile.dart") + ":") |
| 41 ])); | 42 ])); |
| 42 | 43 |
| 43 // It's nondeterministic what order the dart2js transformers start running, | 44 // It's nondeterministic what order the dart2js transformers start running, |
| 44 // so we allow the error messages to be emitted in either order. | 45 // so we allow the error messages to be emitted in either order. |
| 45 pub.stderr.expect(either( | 46 pub.stderr.expect(either( |
| 46 inOrder([consumeFile, consumeSubfile]), | 47 inOrder([consumeFile, consumeSubfile]), |
| 47 inOrder([consumeSubfile, consumeFile]))); | 48 inOrder([consumeSubfile, consumeFile]))); |
| 48 | 49 |
| 49 pub.shouldExit(exit_codes.DATA); | 50 pub.shouldExit(exit_codes.DATA); |
| 50 | 51 |
| 51 // Doesn't output anything if an error occurred. | 52 // Doesn't output anything if an error occurred. |
| 52 d.dir(appPath, [ | 53 d.dir(appPath, [ |
| 53 d.dir('build', [ | 54 d.dir('build', [ |
| 54 d.nothing('web') | 55 d.nothing('web') |
| 55 ]) | 56 ]) |
| 56 ]).validate(); | 57 ]).validate(); |
| 57 }); | 58 }); |
| 58 } | 59 } |
| OLD | NEW |