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 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
12 | 12 |
13 import '../descriptor.dart' as d; | 13 import '../descriptor.dart' as d; |
14 import '../test_pub.dart'; | 14 import '../test_pub.dart'; |
15 import 'utils.dart'; | 15 import 'utils.dart'; |
16 | 16 |
17 main() { | 17 main() { |
18 // This is a regression test for http://dartbug.com/21402. | 18 // This is a regression test for http://dartbug.com/21402. |
19 withBarbackVersions("any", () { | 19 integration("picks up files replaced after serving started when using the " |
20 integration("picks up files replaced after serving started when using the " | 20 "native watcher", () { |
21 "native watcher", () { | 21 d.dir(appPath, [ |
22 d.dir(appPath, [ | 22 d.pubspec({ |
23 d.pubspec({ | 23 "name": "myapp", |
24 "name": "myapp", | 24 "transformers": ["myapp/src/transformer"] |
25 "transformers": ["myapp/src/transformer"] | 25 }), |
26 }), | 26 d.dir("lib", [d.dir("src", [ |
27 d.dir("lib", [d.dir("src", [ | 27 d.file("transformer.dart", REWRITE_TRANSFORMER) |
28 d.file("transformer.dart", REWRITE_TRANSFORMER) | 28 ])]), |
29 ])]), | 29 d.dir("web", [ |
30 d.dir("web", [ | 30 d.file("file.txt", "before"), |
31 d.file("file.txt", "before"), | 31 ]), |
32 ]), | 32 d.file("other", "after") |
33 d.file("other", "after") | 33 ]).create(); |
34 ]).create(); | |
35 | 34 |
36 createLockFile("myapp", pkg: ["barback"]); | 35 createLockFile("myapp", pkg: ["barback"]); |
37 | 36 |
38 pubServe(args: ["--no-force-poll"]); | 37 pubServe(args: ["--no-force-poll"]); |
39 waitForBuildSuccess(); | 38 waitForBuildSuccess(); |
40 requestShouldSucceed("file.out", "before.out"); | 39 requestShouldSucceed("file.out", "before.out"); |
41 | 40 |
42 schedule(() { | 41 schedule(() { |
43 // Replace file.txt by renaming other on top of it. | 42 // Replace file.txt by renaming other on top of it. |
44 return new File(p.join(sandboxDir, appPath, "other")) | 43 return new File(p.join(sandboxDir, appPath, "other")) |
45 .rename(p.join(sandboxDir, appPath, "web", "file.txt")); | 44 .rename(p.join(sandboxDir, appPath, "web", "file.txt")); |
46 }); | 45 }); |
47 | 46 |
48 // Read the transformed file to ensure the change is actually noticed by | 47 // Read the transformed file to ensure the change is actually noticed by |
49 // pub and not that we just get the new file contents piped through | 48 // pub and not that we just get the new file contents piped through |
50 // without pub realizing they've changed. | 49 // without pub realizing they've changed. |
51 waitForBuildSuccess(); | 50 waitForBuildSuccess(); |
52 requestShouldSucceed("file.out", "after.out"); | 51 requestShouldSucceed("file.out", "after.out"); |
53 | 52 |
54 endPubServe(); | 53 endPubServe(); |
55 }); | 54 }); |
56 }); | |
57 } | 55 } |
OLD | NEW |