OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, 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 @TestOn("vm") |
| 6 @Tags(const ["chrome"]) |
| 7 |
| 8 import 'dart:io'; |
| 9 |
| 10 import 'package:path/path.dart' as p; |
| 11 import 'package:scheduled_test/descriptor.dart' as d; |
| 12 import 'package:scheduled_test/scheduled_process.dart'; |
| 13 import 'package:scheduled_test/scheduled_stream.dart'; |
| 14 import 'package:scheduled_test/scheduled_test.dart'; |
| 15 |
| 16 import 'package:test/src/util/io.dart'; |
| 17 |
| 18 import '../io.dart'; |
| 19 |
| 20 void main() { |
| 21 useSandbox(); |
| 22 |
| 23 test("runs a precompiled version of a test rather than recompiling", () { |
| 24 d.file("to_precompile.dart", """ |
| 25 import "package:stream_channel/stream_channel.dart"; |
| 26 |
| 27 import "package:test/src/runner/plugin/remote_platform_helpers.dart"; |
| 28 import "package:test/src/runner/browser/post_message_channel.dart"; |
| 29 import "package:test/test.dart"; |
| 30 |
| 31 main(_) async { |
| 32 var channel = serializeSuite(() { |
| 33 return () => test("success", () {}); |
| 34 }, hidePrints: false); |
| 35 postMessageChannel().pipe(channel); |
| 36 } |
| 37 """).create(); |
| 38 |
| 39 d.dir("precompiled", []).create(); |
| 40 |
| 41 var dart2js = new ScheduledProcess.start(p.join(sdkDir, 'bin', 'dart2js'), [ |
| 42 "--package-root=${p.join(p.current, 'packages')}", |
| 43 "to_precompile.dart", |
| 44 "--out=precompiled/test.dart.browser_test.dart.js" |
| 45 ], workingDirectory: sandbox); |
| 46 dart2js.shouldExit(0); |
| 47 |
| 48 d.file("test.dart", "invalid dart}").create(); |
| 49 |
| 50 var test = runTest( |
| 51 ["-p", "chrome", "--precompiled=precompiled/", "test.dart"]); |
| 52 test.stdout.expect(containsInOrder([ |
| 53 "+0: success", |
| 54 "+1: All tests passed!" |
| 55 ])); |
| 56 test.shouldExit(0); |
| 57 }); |
| 58 } |
OLD | NEW |