OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2013, 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:pub/src/exit_codes.dart' as exit_codes; | 7 import 'package:pub/src/exit_codes.dart' as exit_codes; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
9 import 'package:scheduled_test/scheduled_stream.dart'; | 9 import 'package:scheduled_test/scheduled_stream.dart'; |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 return transform.primaryInput.readAsString().then((contents) { | 32 return transform.primaryInput.readAsString().then((contents) { |
33 var id = transform.primaryInput.id.changeExtension(".out"); | 33 var id = transform.primaryInput.id.changeExtension(".out"); |
34 transform.addOutput(new Asset.fromString(id, "\$contents.out")); | 34 transform.addOutput(new Asset.fromString(id, "\$contents.out")); |
35 }); | 35 }); |
36 } | 36 } |
37 } | 37 } |
38 """; | 38 """; |
39 | 39 |
40 main() { | 40 main() { |
41 integration("can log messages", () { | 41 integration("can log messages", () { |
| 42 serveBarback(); |
| 43 |
42 d.dir(appPath, [ | 44 d.dir(appPath, [ |
43 d.pubspec({ | 45 d.pubspec({ |
44 "name": "myapp", | 46 "name": "myapp", |
45 "transformers": ["myapp/src/transformer"] | 47 "transformers": ["myapp/src/transformer"], |
| 48 "dependencies": {"barback": "any"} |
46 }), | 49 }), |
47 d.dir("lib", [d.dir("src", [ | 50 d.dir("lib", [d.dir("src", [ |
48 d.file("transformer.dart", TRANSFORMER) | 51 d.file("transformer.dart", TRANSFORMER) |
49 ])]), | 52 ])]), |
50 d.dir("web", [ | 53 d.dir("web", [ |
51 d.file("foo.txt", "foo") | 54 d.file("foo.txt", "foo") |
52 ]) | 55 ]) |
53 ]).create(); | 56 ]).create(); |
54 | 57 |
55 createLockFile('myapp', pkg: ['barback']); | 58 pubGet(); |
56 | |
57 var pub = startPub(args: ["build"]); | 59 var pub = startPub(args: ["build"]); |
58 pub.stdout.expect(startsWith("Loading source assets...")); | 60 pub.stdout.expect(startsWith("Loading source assets...")); |
59 pub.stdout.expect(consumeWhile(matches("Loading .* transformers..."))); | 61 pub.stdout.expect(consumeWhile(matches("Loading .* transformers..."))); |
60 pub.stdout.expect(startsWith("Building myapp...")); | 62 pub.stdout.expect(startsWith("Building myapp...")); |
61 | 63 |
62 pub.stdout.expect(emitsLines(""" | 64 pub.stdout.expect(emitsLines(""" |
63 [Rewrite on myapp|web/foo.txt]: | 65 [Rewrite on myapp|web/foo.txt]: |
64 info!""")); | 66 info!""")); |
65 | 67 |
66 pub.stderr.expect(emitsLines(""" | 68 pub.stderr.expect(emitsLines(""" |
(...skipping 13 matching lines...) Expand all Loading... |
80 | 82 |
81 // In barback >=0.15.0, the span will point to the location where the error | 83 // In barback >=0.15.0, the span will point to the location where the error |
82 // occurred. | 84 // occurred. |
83 pub.stderr.expect(allow(inOrder(["d", "^"]))); | 85 pub.stderr.expect(allow(inOrder(["d", "^"]))); |
84 | 86 |
85 pub.stderr.expect("Build failed."); | 87 pub.stderr.expect("Build failed."); |
86 | 88 |
87 pub.shouldExit(exit_codes.DATA); | 89 pub.shouldExit(exit_codes.DATA); |
88 }); | 90 }); |
89 } | 91 } |
OLD | NEW |