OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 library pub_tests; | 5 // Dart2js can take a long time to compile dart code, so we increase the timeout |
| 6 // to cope with that. |
| 7 @Timeout.factor(3) |
6 | 8 |
7 import 'package:pub/src/exit_codes.dart' as exit_codes; | 9 import 'package:pub/src/exit_codes.dart' as exit_codes; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
9 | 11 |
10 import '../descriptor.dart' as d; | 12 import '../descriptor.dart' as d; |
11 import '../test_pub.dart'; | 13 import '../test_pub.dart'; |
12 | 14 |
13 const TRANSFORMER = """ | 15 const TRANSFORMER = """ |
14 import 'dart:async'; | 16 import 'dart:async'; |
15 | 17 |
16 import 'package:barback/barback.dart'; | 18 import 'package:barback/barback.dart'; |
17 | 19 |
18 class RewriteTransformer extends Transformer { | 20 class RewriteTransformer extends Transformer { |
19 RewriteTransformer.asPlugin(); | 21 RewriteTransformer.asPlugin(); |
20 | 22 |
21 String get allowedExtensions => '.txt'; | 23 String get allowedExtensions => '.txt'; |
22 | 24 |
23 Future apply(Transform transform) => throw new Exception('oh no!'); | 25 Future apply(Transform transform) => throw new Exception('oh no!'); |
24 } | 26 } |
25 """; | 27 """; |
26 | 28 |
27 main() { | 29 main() { |
28 initConfig(); | |
29 withBarbackVersions("any", () { | 30 withBarbackVersions("any", () { |
30 integration("outputs error to JSON in a failed build", () { | 31 integration("outputs error to JSON in a failed build", () { |
31 // Loading transformers takes several seconds, so make sure we don't | |
32 // timeout. | |
33 currentSchedule.timeout *= 2; | |
34 | |
35 d.dir(appPath, [ | 32 d.dir(appPath, [ |
36 d.pubspec({ | 33 d.pubspec({ |
37 "name": "myapp", | 34 "name": "myapp", |
38 "transformers": ["myapp"] | 35 "transformers": ["myapp"] |
39 }), | 36 }), |
40 d.dir("lib", [ | 37 d.dir("lib", [ |
41 d.file("transformer.dart", TRANSFORMER) | 38 d.file("transformer.dart", TRANSFORMER) |
42 ]), | 39 ]), |
43 d.dir("web", [ | 40 d.dir("web", [ |
44 d.file("foo.txt", "foo") | 41 d.file("foo.txt", "foo") |
(...skipping 10 matching lines...) Expand all Loading... |
55 "error": startsWith("Transform Rewrite on myapp|web/foo.txt " | 52 "error": startsWith("Transform Rewrite on myapp|web/foo.txt " |
56 "threw error: oh no!") | 53 "threw error: oh no!") |
57 } | 54 } |
58 ], | 55 ], |
59 "log": [] | 56 "log": [] |
60 }, | 57 }, |
61 exitCode: exit_codes.DATA); | 58 exitCode: exit_codes.DATA); |
62 }); | 59 }); |
63 }); | 60 }); |
64 } | 61 } |
OLD | NEW |