Add coveralls support (#134)

diff --git a/.travis.yml b/.travis.yml
index ae59852..6d661f4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,6 +35,9 @@
     - stage: testing
       script: ./tool/travis.sh dart2js_test
       dart: dev
+    - stage: testing
+      script: ./tool/travis.sh coverage
+      dart: dev
 
 # Only building master means that we don't run two builds for each pull request.
 branches:
diff --git a/test/all.dart b/test/all.dart
new file mode 100644
index 0000000..ef120e6
--- /dev/null
+++ b/test/all.dart
@@ -0,0 +1,30 @@
+// Copyright 2018 Dart Mockito authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file explicitly does _not_ end in `_test.dart`, so that it is not picked
+// up by `pub run test`. It is here for coveralls.
+
+import 'capture_test.dart' as capture_test;
+import 'invocation_matcher_test.dart' as invocation_matcher_test;
+import 'mockito_test.dart' as mockito_test;
+import 'until_called_test.dart' as until_called_test;
+import 'verify_test.dart' as verify_test;
+
+void main() {
+  capture_test.main();
+  invocation_matcher_test.main();
+  mockito_test.main();
+  until_called_test.main();
+  verify_test.main();
+}
diff --git a/tool/travis.sh b/tool/travis.sh
index 38419b8..748d619 100755
--- a/tool/travis.sh
+++ b/tool/travis.sh
@@ -54,6 +54,20 @@
     echo -e 'pub run test -p chrome'
     pub run test -p chrome || EXIT_CODE=$?
     ;;
+  coverage) echo
+    echo -e '\033[1mTASK: coverage\033[22m'
+    if [ "$REPO_TOKEN" ]; then
+      echo -e 'pub run dart_coveralls report test/all.dart'
+      pub global activate dart_coveralls
+      pub global run dart_coveralls report \
+        --token $REPO_TOKEN \
+        --retry 2 \
+        --exclude-test-files \
+        test/all.dart
+    else
+      echo -e "\033[33mNo token for coveralls. Skipping.\033[0m"
+    fi
+    ;;
   *) echo -e "\033[31mNot expecting TASK '${TASK}'. Error!\033[0m"
     EXIT_CODE=1
     ;;