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