Skip to content
Snippets Groups Projects
Commit a3847515 authored by Natalie Weizenbaum's avatar Natalie Weizenbaum
Browse files

Use the new test runner.

R=rnystrom@google.com

Review URL: https://codereview.chromium.org//1215833002.
parent b1ffbfc3
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 48 deletions
......@@ -482,6 +482,15 @@ void createPackageSymlink(String name, String target, String symlink,
final bool runningAsTest =
!path.url.basename(Platform.script.path).startsWith('pub.');
// TODO(nweiz): Use the test API when test#48 is fixed.
/// Whether the current process is one of pub's test files being run through the
/// test package's test runner.
///
/// The test runner starts all tests from an entrypoint called
/// "runInIsolate.dart'>
final bool runningAsTestRunner =
path.url.basename(Platform.script.path).startsWith('runInIsolate.dart');
/// Whether the current process is a pub subprocess being run from a test.
///
/// The "_PUB_TESTING" variable is automatically set for all the test code's
......@@ -535,6 +544,9 @@ final String pubRoot = (() {
throw new StateError("Can't get pub's root from the SDK.");
}
// The test runner always runs from the working directory.
if (runningAsTestRunner) return path.current;
var script = path.fromUri(Platform.script);
if (runningAsTest) {
// Running from "test/../some_test.dart".
......
......@@ -32,9 +32,8 @@ dependencies:
package_config: "^0.0.4"
dev_dependencies:
scheduled_test: "^0.11.8"
source_maps: "^0.9.0"
unittest: "^0.11.0"
scheduled_test: "^0.12.0"
test: "^0.12.3+3"
environment:
sdk: ">=1.11.0-dev.3.0 <2.0.0"
......@@ -6,7 +6,7 @@ library lock_file_test;
import 'package:pub/src/ascii_tree.dart' as tree;
import 'package:pub/src/utils.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';
main() {
group('tree.fromFiles', () {
......
......@@ -9,8 +9,6 @@ import '../serve/utils.dart';
import '../test_pub.dart';
main() {
initConfig();
setUp(() {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -9,8 +9,6 @@ import '../test_pub.dart';
import '../serve/utils.dart';
main() {
initConfig();
setUp(() {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -10,8 +10,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.appDir().create();
});
......
......@@ -10,8 +10,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -10,8 +10,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.appDir().create();
});
......
......@@ -10,8 +10,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.appDir().create();
});
......
......@@ -10,8 +10,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.appDir().create();
});
......
......@@ -11,8 +11,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.appDir().create();
});
......
......@@ -11,8 +11,6 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
setUp(() {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -10,8 +10,6 @@ import '../serve/utils.dart';
import '../test_pub.dart';
main() {
initConfig();
setUp(() {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -28,7 +28,6 @@ class ModeTransformer extends Transformer {
""";
main() {
initConfig();
withBarbackVersions("any", () {
integration("allows user-defined mode names", () {
d.dir(appPath, [
......
......@@ -11,7 +11,6 @@ import '../descriptor.dart' as d;
import '../test_pub.dart';
main() {
initConfig();
integration("can specify the output directory to build into", () {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -6,8 +6,6 @@ import '../descriptor.dart' as d;
import '../test_pub.dart';
main() {
initConfig();
integration("cleans entire build directory before a build", () {
d.dir(appPath, [
d.appPubspec(),
......
......@@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart2js can take a long time to compile dart code, so we increase the timeout
// to cope with that.
@Timeout.factor(3)
import 'package:scheduled_test/scheduled_test.dart';
import '../descriptor.dart' as d;
......@@ -9,13 +13,7 @@ import '../test_pub.dart';
import 'utils.dart';
main() {
initConfig();
integration("compiles dart.js and interop.js next to entrypoints", () {
// Dart2js can take a long time to compile dart code, so we increase the
// timeout to cope with that.
currentSchedule.timeout *= 3;
serveBrowserPackage();
d.dir(appPath, [
......
......@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Timeout.factor(3)
import 'package:scheduled_test/scheduled_test.dart';
import '../descriptor.dart' as d;
......@@ -11,14 +13,8 @@ import 'utils.dart';
main() {
// This is a regression test for http://dartbug.com/16617.
initConfig();
integration("compiles dart.js and interop.js next to entrypoints when "
"browser is a dependency_override", () {
// Dart2js can take a long time to compile dart code, so we increase the
// timeout to cope with that.
currentSchedule.timeout *= 3;
serveBrowserPackage();
d.dir(appPath, [
......
......@@ -2,6 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart2js can take a long time to compile dart code, so we increase the timeout
// to cope with that.
@Timeout.factor(3)
import 'package:scheduled_test/scheduled_test.dart';
import '../descriptor.dart' as d;
......@@ -11,14 +15,8 @@ import 'utils.dart';
main() {
// This is a regression test for http://dartbug.com/16617.
initConfig();
integration("compiles dart.js and interop.js next to entrypoints when "
"browser is a dev dependency", () {
// Dart2js can take a long time to compile dart code, so we increase the
// timeout to cope with that.
currentSchedule.timeout *= 3;
serveBrowserPackage();
d.dir(appPath, [
......
......@@ -6,8 +6,6 @@ import '../descriptor.dart' as d;
import '../test_pub.dart';
main() {
initConfig();
integration("copies non-Dart files to build/", () {
servePackages((builder) => builder.serve("browser", "1.0.0"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment