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 library pub_tests; |
6 | 6 |
7 import 'package:scheduled_test/scheduled_stream.dart'; | 7 import 'package:scheduled_test/scheduled_stream.dart'; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
9 | 9 |
10 import '../../descriptor.dart' as d; | 10 import '../../descriptor.dart' as d; |
11 import '../../test_pub.dart'; | 11 import '../../test_pub.dart'; |
12 import '../../serve/utils.dart'; | 12 import '../../serve/utils.dart'; |
13 | 13 |
14 main() { | 14 main() { |
15 integration("works on a lazy transformer", () { | 15 integration("works on a lazy transformer", () { |
| 16 serveBarback(); |
| 17 |
16 d.dir(appPath, [ | 18 d.dir(appPath, [ |
17 d.pubspec({ | 19 d.pubspec({ |
18 "name": "myapp", | 20 "name": "myapp", |
19 "transformers": [ | 21 "transformers": [ |
20 { | 22 { |
21 "myapp": { | 23 "myapp": { |
22 "\$include": ["web/a.txt", "web/b.txt"], | 24 "\$include": ["web/a.txt", "web/b.txt"], |
23 "\$exclude": "web/a.txt" | 25 "\$exclude": "web/a.txt" |
24 } | 26 } |
25 } | 27 } |
26 ] | 28 ], |
| 29 "dependencies": {"barback": "any"} |
27 }), | 30 }), |
28 d.dir("lib", [d.file("transformer.dart", LAZY_TRANSFORMER)]), | 31 d.dir("lib", [d.file("transformer.dart", LAZY_TRANSFORMER)]), |
29 d.dir("web", [ | 32 d.dir("web", [ |
30 d.file("a.txt", "a"), | 33 d.file("a.txt", "a"), |
31 d.file("b.txt", "b"), | 34 d.file("b.txt", "b"), |
32 d.file("c.txt", "c") | 35 d.file("c.txt", "c") |
33 ]) | 36 ]) |
34 ]).create(); | 37 ]).create(); |
35 | 38 |
36 createLockFile('myapp', pkg: ['barback']); | 39 pubGet(); |
37 | |
38 var server = pubServe(); | 40 var server = pubServe(); |
39 // The transformer should remain lazy. | 41 // The transformer should remain lazy. |
40 server.stdout.expect("Build completed successfully"); | 42 server.stdout.expect("Build completed successfully"); |
41 | 43 |
42 requestShould404("a.out"); | 44 requestShould404("a.out"); |
43 requestShouldSucceed("b.out", isNot(isEmpty)); | 45 requestShouldSucceed("b.out", isNot(isEmpty)); |
44 server.stdout.expect(consumeThrough(emitsLines( | 46 server.stdout.expect(consumeThrough(emitsLines( |
45 "[Info from LazyRewrite]:\n" | 47 "[Info from LazyRewrite]:\n" |
46 "Rewriting myapp|web/b.txt."))); | 48 "Rewriting myapp|web/b.txt."))); |
47 server.stdout.expect(consumeThrough("Build completed successfully")); | 49 server.stdout.expect(consumeThrough("Build completed successfully")); |
48 | 50 |
49 requestShould404("c.out"); | 51 requestShould404("c.out"); |
50 endPubServe(); | 52 endPubServe(); |
51 }); | 53 }); |
52 } | 54 } |
OLD | NEW |