Try using a staged, fancy travis config. (#100)

* Try using a staged, fancy travis config.

* Remove env.

* Use dart:dev .

* Fix script.

* Fix script.

* Ignore DDC failures for now.

* Fix dart2js.

* Actually skip.

* Fix again.

* Dartfmt.

* Add dart_test.yaml.

* Try firefox instead.

* Fix travis.
diff --git a/.gitignore b/.gitignore
index 04fd6ee..d87ef84 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 # See https://www.dartlang.org/guides/libraries/private-files
 
 # Files and directories created by pub
+.dart_tool
 .packages
 .pub
 pubspec.lock
diff --git a/.travis.yml b/.travis.yml
index 103a8a0..ae59852 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,53 @@
 language: dart
-sudo: false
-dart:
-  - dev
-script: ./tool/travis.sh
+
+# Gives more resources on Travis (8GB Ram, 2 CPUs).
+# Do not remove without verifying w/ Travis.
+sudo: required
+addons:
+  chrome: stable
+
+# Build stages: https://docs.travis-ci.com/user/build-stages/.
+stages:
+  - presubmit
+  - build
+  - testing
+
+# 1. Run dartfmt, dartanalyzer, pub run test (VM).
+# 2. Then run a build.
+# 3. Then run tests compiled via dartdevc and dart2js.
+jobs:
+  include:
+    - stage: presubmit
+      script: ./tool/travis.sh dartfmt
+      dart: dev
+    - stage: presubmit
+      script: ./tool/travis.sh dartanalyzer
+      dart: dev
+    - stage: presubmit
+      script: ./tool/travis.sh vm_test
+      dart: dev
+    - stage: build
+      script: ./tool/travis.sh dartdevc_build
+      dart: dev
+    - stage: testing
+      script: ./tool/travis.sh dartdevc_test
+      dart: dev
+    - stage: testing
+      script: ./tool/travis.sh dart2js_test
+      dart: dev
+
+# Only building master means that we don't run two builds for each pull request.
+branches:
+  only: [master]
+
+# Incremental pub cache and builds.
+cache:
+  directories:
+    - $HOME/.pub-cache
+    - .dart_tool
+
+# Necessary for Chrome and Firefox to run
+before_install:
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+ - "t=0; until (xdpyinfo -display :99 &> /dev/null || test $t -gt 10); do sleep 1; let t=$t+1; done"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0156b3f..38b21cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,10 +3,9 @@
 * `thenReturn` now throws an `ArgumentError` if either a `Future` or `Stream`
   is provided. `thenReturn` calls with futures and streams should be changed to
   `thenAnswer`. See the README for more information.
-* Completely remove the mirrors implementation of Mockito (`mirrors.dart`).
 * `thenReturn` and `thenAnswer` now support generics and infer the correct
   types from the `when` call.
-
+* Completely remove the mirrors implementation of Mockito (`mirrors.dart`).
 
 ## 2.2.0
 
diff --git a/dart_test.yaml b/dart_test.yaml
new file mode 100644
index 0000000..0a3cb47
--- /dev/null
+++ b/dart_test.yaml
@@ -0,0 +1,5 @@
+# TODO(https://github.com/dart-lang/test/issues/772): Headless chrome timeout.
+override_platforms:
+  chrome:
+    settings:
+      headless: false
diff --git a/lib/src/mock.dart b/lib/src/mock.dart
index cf54cda..8a80011 100644
--- a/lib/src/mock.dart
+++ b/lib/src/mock.dart
@@ -297,7 +297,7 @@
 }
 
 class PostExpectation<T> {
-  T thenReturn(T expected) {
+  void thenReturn(T expected) {
     if (expected is Future) {
       throw new ArgumentError(
           '`thenReturn` should not be used to return a Future. '
@@ -311,22 +311,20 @@
     return _completeWhen((_) => expected);
   }
 
-  thenThrow(throwable) {
+  void thenThrow(throwable) {
     return _completeWhen((_) {
       throw throwable;
     });
   }
 
-  T thenAnswer(Answering<T> answer) {
+  void thenAnswer(Answering<T> answer) {
     return _completeWhen(answer);
   }
 
-  _completeWhen(Answering answer) {
+  void _completeWhen(Answering answer) {
     _whenCall._setExpected(answer);
-    var mock = _whenCall.mock;
     _whenCall = null;
     _whenInProgress = false;
-    return mock;
   }
 }
 
@@ -563,18 +561,18 @@
 }
 
 /// An argument matcher that matches any argument passed in "this" position.
-get any => new ArgMatcher(anything, false);
+/*ArgMatcher*/ get any => new ArgMatcher(anything, false);
 
 /// An argument matcher that matches any argument passed in "this" position, and
 /// captures the argument for later access with `captured`.
-get captureAny => new ArgMatcher(anything, true);
+/*ArgMatcher*/ get captureAny => new ArgMatcher(anything, true);
 
 /// An argument matcher that matches an argument that matches [matcher].
-argThat(Matcher matcher) => new ArgMatcher(matcher, false);
+/*ArgMatcher*/ argThat(Matcher matcher) => new ArgMatcher(matcher, false);
 
 /// An argument matcher that matches an argument that matches [matcher], and
 /// captures the argument for later access with `captured`.
-captureThat(Matcher matcher) => new ArgMatcher(matcher, true);
+/*ArgMatcher*/ captureThat(Matcher matcher) => new ArgMatcher(matcher, true);
 
 /// A Strong-mode safe argument matcher that wraps other argument matchers.
 /// See the README for a full explanation.
diff --git a/pubspec.yaml b/pubspec.yaml
index c9c83a0..5f2ec9a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -7,8 +7,14 @@
 homepage: https://github.com/dart-lang/mockito
 environment:
   sdk: '>=2.0.0-dev.16.0 <2.0.0'
+
 dependencies:
   collection: '^1.1.0'
   matcher: '^0.12.0'
   meta: '^1.0.4'
   test: '>=0.12.0 <0.13.0'
+
+dev_dependencies:
+  build_runner: ^0.7.11
+  build_test: ^0.10.0
+  build_web_compilers: ^0.3.1
diff --git a/test/invocation_matcher_test.dart b/test/invocation_matcher_test.dart
index bd96900..4f46ae7 100644
--- a/test/invocation_matcher_test.dart
+++ b/test/invocation_matcher_test.dart
@@ -22,9 +22,12 @@
 
   group('$isInvocation', () {
     test('positional arguments', () {
-      var call1 = stub.say('Hello');
-      var call2 = stub.say('Hello');
-      var call3 = stub.say('Guten Tag');
+      stub.say('Hello');
+      var call1 = Stub.lastInvocation;
+      stub.say('Hello');
+      var call2 = Stub.lastInvocation;
+      stub.say('Guten Tag');
+      var call3 = Stub.lastInvocation;
       shouldPass(call1, isInvocation(call2));
       shouldFail(
         call1,
@@ -36,9 +39,12 @@
     });
 
     test('named arguments', () {
-      var call1 = stub.eat('Chicken', alsoDrink: true);
-      var call2 = stub.eat('Chicken', alsoDrink: true);
-      var call3 = stub.eat('Chicken', alsoDrink: false);
+      stub.eat('Chicken', alsoDrink: true);
+      var call1 = Stub.lastInvocation;
+      stub.eat('Chicken', alsoDrink: true);
+      var call2 = Stub.lastInvocation;
+      stub.eat('Chicken', alsoDrink: false);
+      var call3 = Stub.lastInvocation;
       shouldPass(call1, isInvocation(call2));
       shouldFail(
         call1,
@@ -50,9 +56,12 @@
     });
 
     test('optional arguments', () {
-      var call1 = stub.lie(true);
-      var call2 = stub.lie(true);
-      var call3 = stub.lie(false);
+      stub.lie(true);
+      var call1 = Stub.lastInvocation;
+      stub.lie(true);
+      var call2 = Stub.lastInvocation;
+      stub.lie(false);
+      var call3 = Stub.lastInvocation;
       shouldPass(call1, isInvocation(call2));
       shouldFail(
         call1,
@@ -64,11 +73,13 @@
     });
 
     test('getter', () {
-      var call1 = stub.value;
-      var call2 = stub.value;
+      stub.value;
+      var call1 = Stub.lastInvocation;
+      stub.value;
+      var call2 = Stub.lastInvocation;
       stub.value = true;
       var call3 = Stub.lastInvocation;
-      shouldPass(call1, isInvocation(call2 as Invocation));
+      shouldPass(call1, isInvocation(call2));
       shouldFail(
         call1,
         isInvocation(call3),
@@ -98,7 +109,8 @@
 
   group('$invokes', () {
     test('positional arguments', () {
-      var call = stub.say('Hello');
+      stub.say('Hello');
+      var call = Stub.lastInvocation;
       shouldPass(call, invokes(#say, positionalArguments: ['Hello']));
       shouldPass(call, invokes(#say, positionalArguments: [anything]));
       shouldFail(
@@ -111,7 +123,8 @@
     });
 
     test('named arguments', () {
-      var call = stub.fly(miles: 10);
+      stub.fly(miles: 10);
+      var call = Stub.lastInvocation;
       shouldPass(call, invokes(#fly, namedArguments: {#miles: 10}));
       shouldPass(call, invokes(#fly, namedArguments: {#miles: greaterThan(5)}));
       shouldFail(
@@ -143,7 +156,9 @@
   const Stub();
 
   @override
-  noSuchMethod(Invocation invocation) => lastInvocation = invocation;
+  noSuchMethod(Invocation invocation) {
+    lastInvocation = invocation;
+  }
 }
 
 // Copied from package:test, which doesn't expose it to users.
diff --git a/test/mockito_test.dart b/test/mockito_test.dart
index a129473..7a9a44f 100644
--- a/test/mockito_test.dart
+++ b/test/mockito_test.dart
@@ -167,39 +167,42 @@
     });
 
     test("should mock method with argument matcher", () {
-      when(mock.methodWithNormalArgs(argThat(greaterThan(100))))
+      when(mock.methodWithNormalArgs(typed(argThat(greaterThan(100)))))
           .thenReturn("A lot!");
       expect(mock.methodWithNormalArgs(100), isNull);
       expect(mock.methodWithNormalArgs(101), equals("A lot!"));
     });
 
     test("should mock method with any argument matcher", () {
-      when(mock.methodWithNormalArgs(any)).thenReturn("A lot!");
+      when(mock.methodWithNormalArgs(typed(any))).thenReturn("A lot!");
       expect(mock.methodWithNormalArgs(100), equals("A lot!"));
       expect(mock.methodWithNormalArgs(101), equals("A lot!"));
     });
 
     test("should mock method with any list argument matcher", () {
-      when(mock.methodWithListArgs(any)).thenReturn("A lot!");
+      when(mock.methodWithListArgs(typed(any))).thenReturn("A lot!");
       expect(mock.methodWithListArgs([42]), equals("A lot!"));
       expect(mock.methodWithListArgs([43]), equals("A lot!"));
     });
 
     test("should mock method with multiple named args and matchers", () {
-      when(mock.methodWithTwoNamedArgs(any, y: any)).thenReturn("x y");
-      when(mock.methodWithTwoNamedArgs(any, z: any)).thenReturn("x z");
+      when(mock.methodWithTwoNamedArgs(typed(any), y: typed(any, named: 'y')))
+          .thenReturn("x y");
+      when(mock.methodWithTwoNamedArgs(typed(any), z: typed(any, named: 'z')))
+          .thenReturn("x z");
       expect(mock.methodWithTwoNamedArgs(42), isNull);
       expect(mock.methodWithTwoNamedArgs(42, y: 18), equals("x y"));
       expect(mock.methodWithTwoNamedArgs(42, z: 17), equals("x z"));
       expect(mock.methodWithTwoNamedArgs(42, y: 18, z: 17), isNull);
-      when(mock.methodWithTwoNamedArgs(any, y: any, z: any))
+      when(mock.methodWithTwoNamedArgs(typed(any),
+              y: typed(any, named: 'y'), z: typed(any, named: 'z')))
           .thenReturn("x y z");
       expect(mock.methodWithTwoNamedArgs(42, y: 18, z: 17), equals("x y z"));
     });
 
     test("should mock method with mix of argument matchers and real things",
         () {
-      when(mock.methodWithPositionalArgs(argThat(greaterThan(100)), 17))
+      when(mock.methodWithPositionalArgs(typed(argThat(greaterThan(100))), 17))
           .thenReturn("A lot with 17");
       expect(mock.methodWithPositionalArgs(100, 17), isNull);
       expect(mock.methodWithPositionalArgs(101, 18), isNull);
@@ -248,12 +251,13 @@
 
     //no need to mock setter, except if we will have spies later...
     test("should mock method with thrown result", () {
-      when(mock.methodWithNormalArgs(any)).thenThrow(new StateError('Boo'));
+      when(mock.methodWithNormalArgs(typed(any)))
+          .thenThrow(new StateError('Boo'));
       expect(() => mock.methodWithNormalArgs(42), throwsStateError);
     });
 
     test("should mock method with calculated result", () {
-      when(mock.methodWithNormalArgs(any)).thenAnswer(
+      when(mock.methodWithNormalArgs(typed(any))).thenAnswer(
           (Invocation inv) => inv.positionalArguments[0].toString());
       expect(mock.methodWithNormalArgs(43), equals("43"));
       expect(mock.methodWithNormalArgs(42), equals("42"));
@@ -272,8 +276,10 @@
     });
 
     test("should mock method with calculated result", () {
-      when(mock.methodWithNormalArgs(argThat(equals(43)))).thenReturn("43");
-      when(mock.methodWithNormalArgs(argThat(equals(42)))).thenReturn("42");
+      when(mock.methodWithNormalArgs(typed(argThat(equals(43)))))
+          .thenReturn("43");
+      when(mock.methodWithNormalArgs(typed(argThat(equals(42)))))
+          .thenReturn("42");
       expect(mock.methodWithNormalArgs(43), equals("43"));
     });
 
@@ -356,7 +362,7 @@
 
     test("should mock method when [typed] used alongside matched [null].", () {
       when(mock.typeParameterizedFn(
-              typed(any), argThat(equals(null)), typed(any)))
+              typed(any), typed(argThat(equals(null))), typed(any)))
           .thenReturn("A lot!");
       expect(mock.typeParameterizedFn([42], null, [44]), equals("A lot!"));
     });
@@ -372,7 +378,8 @@
     test("should mock method with named, typed arg matcher and an arg matcher",
         () {
       when(mock.typeParameterizedNamedFn(typed(any), [43],
-              y: typed(any, named: "y"), z: argThat(contains(45))))
+              y: typed(any, named: "y"),
+              z: typed(argThat(contains(45)), named: 'z')))
           .thenReturn("A lot!");
       expect(mock.typeParameterizedNamedFn([42], [43], y: [44], z: [45]),
           equals("A lot!"));
@@ -427,66 +434,76 @@
       test("waits for method with normal args", () async {
         mock.methodWithNormalArgs(1);
 
-        await untilCalled(mock.methodWithNormalArgs(any));
+        await untilCalled(mock.methodWithNormalArgs(typed(any)));
 
-        verify(mock.methodWithNormalArgs(any)).called(1);
+        verify(mock.methodWithNormalArgs(typed(any))).called(1);
       });
 
       test("waits for method with list args", () async {
         mock.methodWithListArgs([1]);
 
-        await untilCalled(mock.methodWithListArgs(any));
+        await untilCalled(mock.methodWithListArgs(typed(any)));
 
-        verify(mock.methodWithListArgs(any)).called(1);
+        verify(mock.methodWithListArgs(typed(any))).called(1);
       });
 
       test("waits for method with positional args", () async {
         mock.methodWithPositionalArgs(1, 2);
 
-        await untilCalled(mock.methodWithPositionalArgs(any, any));
+        await untilCalled(
+            mock.methodWithPositionalArgs(typed(any), typed(any)));
 
-        verify(mock.methodWithPositionalArgs(any, any)).called(1);
+        verify(mock.methodWithPositionalArgs(typed(any), typed(any))).called(1);
       });
 
       test("waits for method with named args", () async {
         mock.methodWithNamedArgs(1, y: 2);
 
-        await untilCalled(mock.methodWithNamedArgs(any, y: any));
+        await untilCalled(
+            mock.methodWithNamedArgs(typed(any), y: typed(any, named: 'y')));
 
-        verify(mock.methodWithNamedArgs(any, y: any)).called(1);
+        verify(mock.methodWithNamedArgs(typed(any), y: typed(any, named: 'y')))
+            .called(1);
       });
 
       test("waits for method with two named args", () async {
         mock.methodWithTwoNamedArgs(1, y: 2, z: 3);
 
-        await untilCalled(mock.methodWithTwoNamedArgs(any, y: any, z: any));
+        await untilCalled(mock.methodWithTwoNamedArgs(typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        verify(mock.methodWithTwoNamedArgs(any, y: any, z: any)).called(1);
+        verify(mock.methodWithTwoNamedArgs(typed(any),
+                y: typed(any, named: 'y'), z: typed(any, named: 'z')))
+            .called(1);
       });
 
       test("waits for method with obj args", () async {
         mock.methodWithObjArgs(new RealClass());
 
-        await untilCalled(mock.methodWithObjArgs(any));
+        await untilCalled(mock.methodWithObjArgs(typed(any)));
 
-        verify(mock.methodWithObjArgs(any)).called(1);
+        verify(mock.methodWithObjArgs(typed(any))).called(1);
       });
 
       test("waits for function with positional parameters", () async {
         mock.typeParameterizedFn([1, 2], [3, 4], [5, 6], [7, 8]);
 
-        await untilCalled(mock.typeParameterizedFn(any, any, any, any));
+        await untilCalled(mock.typeParameterizedFn(
+            typed(any), typed(any), typed(any), typed(any)));
 
-        verify(mock.typeParameterizedFn(any, any, any, any)).called(1);
+        verify(mock.typeParameterizedFn(
+                typed(any), typed(any), typed(any), typed(any)))
+            .called(1);
       });
 
       test("waits for function with named parameters", () async {
         mock.typeParameterizedNamedFn([1, 2], [3, 4], y: [5, 6], z: [7, 8]);
 
-        await untilCalled(
-            mock.typeParameterizedNamedFn(any, any, y: any, z: any));
+        await untilCalled(mock.typeParameterizedNamedFn(typed(any), typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        verify(mock.typeParameterizedNamedFn(any, any, y: any, z: any))
+        verify(mock.typeParameterizedNamedFn(typed(any), typed(any),
+                y: typed(any, named: 'y'), z: typed(any, named: 'z')))
             .called(1);
       });
 
@@ -523,75 +540,89 @@
 
       test("waits for method with normal args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithNormalArgs(any));
+        verifyNever(mock.methodWithNormalArgs(typed(any)));
 
-        await untilCalled(mock.methodWithNormalArgs(any));
+        await untilCalled(mock.methodWithNormalArgs(typed(any)));
 
-        verify(mock.methodWithNormalArgs(any)).called(1);
+        verify(mock.methodWithNormalArgs(typed(any))).called(1);
       });
 
       test("waits for method with list args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithListArgs(any));
+        verifyNever(mock.methodWithListArgs(typed(any)));
 
-        await untilCalled(mock.methodWithListArgs(any));
+        await untilCalled(mock.methodWithListArgs(typed(any)));
 
-        verify(mock.methodWithListArgs(any)).called(1);
+        verify(mock.methodWithListArgs(typed(any))).called(1);
       });
 
       test("waits for method with positional args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithPositionalArgs(any, any));
+        verifyNever(mock.methodWithPositionalArgs(typed(any), typed(any)));
 
-        await untilCalled(mock.methodWithPositionalArgs(any, any));
+        await untilCalled(
+            mock.methodWithPositionalArgs(typed(any), typed(any)));
 
-        verify(mock.methodWithPositionalArgs(any, any)).called(1);
+        verify(mock.methodWithPositionalArgs(typed(any), typed(any))).called(1);
       });
 
       test("waits for method with named args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithNamedArgs(any, y: any));
+        verifyNever(
+            mock.methodWithNamedArgs(typed(any), y: typed(any, named: 'y')));
 
-        await untilCalled(mock.methodWithNamedArgs(any, y: any));
+        await untilCalled(
+            mock.methodWithNamedArgs(typed(any), y: typed(any, named: 'y')));
 
-        verify(mock.methodWithNamedArgs(any, y: any)).called(1);
+        verify(mock.methodWithNamedArgs(typed(any), y: typed(any, named: 'y')))
+            .called(1);
       });
 
       test("waits for method with two named args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithTwoNamedArgs(any, y: any, z: any));
+        verifyNever(mock.methodWithTwoNamedArgs(typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        await untilCalled(mock.methodWithTwoNamedArgs(any, y: any, z: any));
+        await untilCalled(mock.methodWithTwoNamedArgs(typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        verify(mock.methodWithTwoNamedArgs(any, y: any, z: any)).called(1);
+        verify(mock.methodWithTwoNamedArgs(typed(any),
+                y: typed(any, named: 'y'), z: typed(any, named: 'z')))
+            .called(1);
       });
 
       test("waits for method with obj args", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.methodWithObjArgs(any));
+        verifyNever(mock.methodWithObjArgs(typed(any)));
 
-        await untilCalled(mock.methodWithObjArgs(any));
+        await untilCalled(mock.methodWithObjArgs(typed(any)));
 
-        verify(mock.methodWithObjArgs(any)).called(1);
+        verify(mock.methodWithObjArgs(typed(any))).called(1);
       });
 
       test("waits for function with positional parameters", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.typeParameterizedFn(any, any, any, any));
+        verifyNever(mock.typeParameterizedFn(
+            typed(any), typed(any), typed(any), typed(any)));
 
-        await untilCalled(mock.typeParameterizedFn(any, any, any, any));
+        await untilCalled(mock.typeParameterizedFn(
+            typed(any), typed(any), typed(any), typed(any)));
 
-        verify(mock.typeParameterizedFn(any, any, any, any)).called(1);
+        verify(mock.typeParameterizedFn(
+                typed(any), typed(any), typed(any), typed(any)))
+            .called(1);
       });
 
       test("waits for function with named parameters", () async {
         streamController.add(new CallMethodsEvent());
-        verifyNever(mock.typeParameterizedNamedFn(any, any, y: any, z: any));
+        verifyNever(mock.typeParameterizedNamedFn(typed(any), typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        await untilCalled(
-            mock.typeParameterizedNamedFn(any, any, y: any, z: any));
+        await untilCalled(mock.typeParameterizedNamedFn(typed(any), typed(any),
+            y: typed(any, named: 'y'), z: typed(any, named: 'z')));
 
-        verify(mock.typeParameterizedNamedFn(any, any, y: any, z: any))
+        verify(mock.typeParameterizedNamedFn(typed(any), typed(any),
+                y: typed(any, named: 'y'), z: typed(any, named: 'z')))
             .called(1);
       });
 
@@ -687,15 +718,16 @@
       expectFail(
           "No matching calls. All calls: MockedClass.methodWithNormalArgs(100)\n"
           "$noMatchingCallsFooter", () {
-        verify(mock.methodWithNormalArgs(argThat(greaterThan(100))));
+        verify(mock.methodWithNormalArgs(typed(argThat(greaterThan(100)))));
       });
-      verify(mock.methodWithNormalArgs(argThat(greaterThanOrEqualTo(100))));
+      verify(
+          mock.methodWithNormalArgs(typed(argThat(greaterThanOrEqualTo(100)))));
     });
 
     test("should mock method with argument capturer", () {
       mock.methodWithNormalArgs(50);
       mock.methodWithNormalArgs(100);
-      expect(verify(mock.methodWithNormalArgs(captureAny)).captured,
+      expect(verify(mock.methodWithNormalArgs(typed(captureAny))).captured,
           equals([50, 100]));
     });
 
@@ -703,12 +735,12 @@
       mock.methodWithNormalArgs(50);
       mock.methodWithNormalArgs(100);
       expect(
-          verify(mock.methodWithNormalArgs(captureThat(greaterThan(75))))
+          verify(mock.methodWithNormalArgs(typed(captureThat(greaterThan(75)))))
               .captured
               .single,
           equals(100));
       expect(
-          verify(mock.methodWithNormalArgs(captureThat(lessThan(75))))
+          verify(mock.methodWithNormalArgs(typed(captureThat(lessThan(75)))))
               .captured
               .single,
           equals(50));
@@ -721,15 +753,16 @@
           "No matching calls. All calls: MockedClass.methodWithPositionalArgs(100, 17)\n"
           "$noMatchingCallsFooter", () {
         verify(mock.methodWithPositionalArgs(
-            argThat(greaterThanOrEqualTo(100)), 18));
+            typed(argThat(greaterThanOrEqualTo(100))), 18));
       });
       expectFail(
           "No matching calls. All calls: MockedClass.methodWithPositionalArgs(100, 17)\n"
           "$noMatchingCallsFooter", () {
-        verify(mock.methodWithPositionalArgs(argThat(greaterThan(100)), 17));
+        verify(mock.methodWithPositionalArgs(
+            typed(argThat(greaterThan(100))), 17));
       });
       verify(mock.methodWithPositionalArgs(
-          argThat(greaterThanOrEqualTo(100)), 17));
+          typed(argThat(greaterThanOrEqualTo(100))), 17));
     });
 
     test("should mock getter", () {
@@ -993,20 +1026,22 @@
   group("capture", () {
     test("capture should work as captureOut", () {
       mock.methodWithNormalArgs(42);
-      expect(verify(mock.methodWithNormalArgs(captureAny)).captured.single,
+      expect(
+          verify(mock.methodWithNormalArgs(typed(captureAny))).captured.single,
           equals(42));
     });
 
     test("should captureOut list arguments", () {
       mock.methodWithListArgs([42]);
-      expect(verify(mock.methodWithListArgs(captureAny)).captured.single,
+      expect(verify(mock.methodWithListArgs(typed(captureAny))).captured.single,
           equals([42]));
     });
 
     test("should captureOut multiple arguments", () {
       mock.methodWithPositionalArgs(1, 2);
       expect(
-          verify(mock.methodWithPositionalArgs(captureAny, captureAny))
+          verify(mock.methodWithPositionalArgs(
+                  typed(captureAny), typed(captureAny)))
               .captured,
           equals([1, 2]));
     });
@@ -1015,7 +1050,8 @@
       mock.methodWithPositionalArgs(1);
       mock.methodWithPositionalArgs(2, 3);
       expect(
-          verify(mock.methodWithPositionalArgs(captureAny, captureAny))
+          verify(mock.methodWithPositionalArgs(
+                  typed(captureAny), typed(captureAny)))
               .captured,
           equals([2, 3]));
     });
@@ -1023,7 +1059,7 @@
     test("should captureOut multiple invocations", () {
       mock.methodWithNormalArgs(1);
       mock.methodWithNormalArgs(2);
-      expect(verify(mock.methodWithNormalArgs(captureAny)).captured,
+      expect(verify(mock.methodWithNormalArgs(typed(captureAny))).captured,
           equals([1, 2]));
     });
   });
diff --git a/tool/travis.sh b/tool/travis.sh
index 93999c1..d3adaad 100755
--- a/tool/travis.sh
+++ b/tool/travis.sh
@@ -14,30 +14,52 @@
 
 #!/bin/bash
 
-# Make sure dartfmt is run on everything
-# This assumes you have dart_style as a dev_dependency
-echo "Checking dartfmt..."
-NEEDS_DARTFMT="$(find lib test -name "*.dart" | xargs dartfmt -n)"
-if [[ ${NEEDS_DARTFMT} != "" ]]
-then
-  echo "FAILED"
-  echo "${NEEDS_DARTFMT}"
+if [ "$#" == "0" ]; then
+  echo -e '\033[31mAt least one task argument must be provided!\033[0m'
   exit 1
 fi
-echo "PASSED"
 
-# Make sure we pass the analyzer
-echo "Checking dartanalyzer..."
-FAILS_ANALYZER="$(find lib test -name "*.dart" | xargs dartanalyzer --options analysis_options.yaml)"
-if [[ $FAILS_ANALYZER == *"[error]"* ]]
-then
-  echo "FAILED"
-  echo "${FAILS_ANALYZER}"
-  exit 1
-fi
-echo "PASSED"
+EXIT_CODE=0
 
-# Fail on anything that fails going forward.
-set -e
+while (( "$#" )); do
+  TASK=$1
+  case $TASK in
+  dartfmt) echo
+    echo -e '\033[1mTASK: dartfmt\033[22m'
+    echo -e 'dartfmt -n --set-exit-if-changed .'
+    dartfmt -n --set-exit-if-changed . || EXIT_CODE=$?
+    ;;
+  dartanalyzer) echo
+    echo -e '\033[1mTASK: dartanalyzer\033[22m'
+    echo -e 'dartanalyzer --fatal-warnings .'
+    dartanalyzer --fatal-warnings . || EXIT_CODE=$?
+    ;;
+  vm_test) echo
+    echo -e '\033[1mTASK: vmn_test\033[22m'
+    echo -e 'pub run test -p vm'
+    pub run test -p vm || EXIT_CODE=$?
+    ;;
+  dartdevc_build) echo
+    echo -e '\033[1mTASK: build\033[22m'
+    echo -e 'pub run build_runner build --fail-on-severe'
+    pub run build_runner build --fail-on-severe || EXIT_CODE=$?
+    ;;
+  dartdevc_test) echo
+    echo -e '\033[1mTASK: dartdevc_test\033[22m'
+    echo -e 'pub run build_runner test -- -p firefox'
+    pub run build_runner test -- -p firefox || EXIT_CODE=$?
+    ;;
+  dart2js_test) echo
+    echo -e '\033[1mTASK: dart2js_test\033[22m'
+    echo -e 'pub run test -p firefox'
+    pub run test -p firefox || EXIT_CODE=$?
+    ;;
+  *) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
+    EXIT_CODE=1
+    ;;
+  esac
 
-pub run test
+  shift
+done
+
+exit $EXIT_CODE