OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:convert'; |
| 6 |
| 7 import 'package:scheduled_test/scheduled_test.dart'; |
| 8 |
| 9 import '../descriptor.dart' as d; |
| 10 import '../test_pub.dart'; |
| 11 |
| 12 main() { |
| 13 initConfig(); |
| 14 integration( |
| 15 "compiles dart.js and interop.js next to entrypoints when " |
| 16 "dartjs is explicitly configured", |
| 17 () { |
| 18 // Dart2js can take a long time to compile dart code, so we increase the |
| 19 // timeout to cope with that. |
| 20 currentSchedule.timeout *= 3; |
| 21 |
| 22 serve([d.dir('api', [d.dir('packages', [d.file('browser', JSON.encode({ |
| 23 'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))] |
| 24 })), |
| 25 d.dir( |
| 26 'browser', |
| 27 [ |
| 28 d.dir( |
| 29 'versions', |
| 30 [ |
| 31 d.file( |
| 32 '1.0.0', |
| 33 JSON.encode( |
| 34 packageVersionApiMap(packageMap('browser',
'1.0.0'), full: true)))])])])]), |
| 35 d.dir( |
| 36 'packages', |
| 37 [ |
| 38 d.dir( |
| 39 'browser', |
| 40 [ |
| 41 d.dir( |
| 42 'versions', |
| 43 [ |
| 44 d.tar( |
| 45 '1.0.0.tar.gz', |
| 46 [ |
| 47 d.file('pubspec.yaml', yaml(packag
eMap("browser", "1.0.0"))), |
| 48 d.dir( |
| 49 'lib', |
| 50 [ |
| 51 d.file('dart.js', 'content
s of dart.js'), |
| 52 d.file('interop.js', 'cont
ents of interop.js')])])])])])]); |
| 53 |
| 54 d.dir(appPath, [d.pubspec({ |
| 55 "name": "myapp", |
| 56 "dependencies": { |
| 57 "browser": "1.0.0" |
| 58 }, |
| 59 "transformers": [{ |
| 60 "\$dart2js": { |
| 61 "minify": true |
| 62 } |
| 63 }] |
| 64 }), |
| 65 d.dir( |
| 66 'web', |
| 67 [d.file('file.dart', 'void main() => print("hello");'),])]).create
(); |
| 68 |
| 69 pubGet(); |
| 70 |
| 71 schedulePub( |
| 72 args: ["build"], |
| 73 output: new RegExp(r'Built 3 files to "build".'), |
| 74 exitCode: 0); |
| 75 |
| 76 d.dir( |
| 77 appPath, |
| 78 [ |
| 79 d.dir( |
| 80 'build', |
| 81 [ |
| 82 d.dir( |
| 83 'web', |
| 84 [ |
| 85 d.matcherFile('file.dart.js', isMinifiedDart2JSOutpu
t), |
| 86 d.dir( |
| 87 'packages', |
| 88 [ |
| 89 d.dir( |
| 90 'browser', |
| 91 [ |
| 92 d.file('dart.js', 'contents of dart.
js'), |
| 93 d.file('interop.js', 'contents of in
terop.js')])]),])])]).validate(); |
| 94 }); |
| 95 } |
OLD | NEW |