OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS 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 import 'dart:convert'; | 5 import 'dart:convert'; |
6 | 6 |
7 import 'package:path/path.dart' as path; | |
8 import 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
9 | 8 |
10 import '../descriptor.dart' as d; | 9 import '../../descriptor.dart' as d; |
11 import '../test_pub.dart'; | 10 import '../../test_pub.dart'; |
12 | 11 |
13 main() { | 12 main() { |
14 initConfig(); | 13 initConfig(); |
15 | 14 |
16 integration("compiles dart.js and interop.js next to entrypoints", () { | 15 integration("compiles dart.js and interop.js next to entrypoints when " |
| 16 "dartjs is explicitly configured", () { |
17 // Dart2js can take a long time to compile dart code, so we increase the | 17 // Dart2js can take a long time to compile dart code, so we increase the |
18 // timeout to cope with that. | 18 // timeout to cope with that. |
19 currentSchedule.timeout *= 3; | 19 currentSchedule.timeout *= 3; |
20 | 20 |
21 serve([ | 21 serve([ |
22 d.dir('api', [ | 22 d.dir('api', [ |
23 d.dir('packages', [ | 23 d.dir('packages', [ |
24 d.file('browser', JSON.encode({ | 24 d.file('browser', JSON.encode({ |
25 'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))] | 25 'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))] |
26 })), | 26 })), |
(...skipping 16 matching lines...) Expand all Loading... |
43 d.file('dart.js', 'contents of dart.js'), | 43 d.file('dart.js', 'contents of dart.js'), |
44 d.file('interop.js', 'contents of interop.js') | 44 d.file('interop.js', 'contents of interop.js') |
45 ]) | 45 ]) |
46 ]) | 46 ]) |
47 ]) | 47 ]) |
48 ]) | 48 ]) |
49 ]) | 49 ]) |
50 ]); | 50 ]); |
51 | 51 |
52 d.dir(appPath, [ | 52 d.dir(appPath, [ |
53 d.appPubspec({"browser": "1.0.0"}), | 53 d.pubspec({ |
| 54 "name": "myapp", |
| 55 "dependencies": { |
| 56 "browser": "1.0.0" |
| 57 }, |
| 58 "transformers": [{ |
| 59 "\$dart2js": { |
| 60 "minify": true |
| 61 } |
| 62 }] |
| 63 }), |
54 d.dir('web', [ | 64 d.dir('web', [ |
55 d.file('file.dart', 'void main() => print("hello");'), | 65 d.file('file.dart', 'void main() => print("hello");'), |
56 d.dir('subdir', [ | |
57 d.file('subfile.dart', 'void main() => print("subhello");') | |
58 ]) | |
59 ]) | 66 ]) |
60 ]).create(); | 67 ]).create(); |
61 | 68 |
62 pubGet(); | 69 pubGet(); |
63 | 70 |
64 schedulePub(args: ["build"], | 71 schedulePub(args: ["build"], |
65 output: new RegExp(r"Built 12 files!"), | 72 output: new RegExp(r"Built 5 files!"), |
66 exitCode: 0); | 73 exitCode: 0); |
67 | 74 |
68 d.dir(appPath, [ | 75 d.dir(appPath, [ |
69 d.dir('build', [ | 76 d.dir('build', [ |
70 d.matcherFile('file.dart.js', isNot(isEmpty)), | 77 d.dir('web', [ |
71 d.matcherFile('file.dart.precompiled.js', isNot(isEmpty)), | 78 d.matcherFile('file.dart.js', isMinifiedDart2JSOutput), |
72 d.matcherFile('file.dart.js.map', isNot(isEmpty)), | 79 d.matcherFile('file.dart.precompiled.js', isNot(isEmpty)), |
73 d.dir('packages', [d.dir('browser', [ | 80 d.matcherFile('file.dart.js.map', isNot(isEmpty)), |
74 d.file('dart.js', 'contents of dart.js'), | 81 d.dir('packages', [ |
75 d.file('interop.js', 'contents of interop.js') | 82 d.dir('browser', [ |
76 ])]), | 83 d.file('dart.js', 'contents of dart.js'), |
77 d.dir('subdir', [ | 84 d.file('interop.js', 'contents of interop.js') |
78 d.dir('packages', [d.dir('browser', [ | 85 ]) |
79 d.file('dart.js', 'contents of dart.js'), | 86 ]), |
80 d.file('interop.js', 'contents of interop.js') | |
81 ])]), | |
82 d.matcherFile('subfile.dart.js', isNot(isEmpty)), | |
83 d.matcherFile('subfile.dart.precompiled.js', isNot(isEmpty)), | |
84 d.matcherFile('subfile.dart.js.map', isNot(isEmpty)) | |
85 ]) | 87 ]) |
86 ]) | 88 ]) |
87 ]).validate(); | 89 ]).validate(); |
88 }); | 90 }); |
89 } | 91 } |
OLD | NEW |