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