Add markTestSkipped API (#1356)

Closes #1355

Prepare to publish.
diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md
index 8eff901..08edf8c 100644
--- a/pkgs/test/CHANGELOG.md
+++ b/pkgs/test/CHANGELOG.md
@@ -1,4 +1,6 @@
-## 1.16.0-nullsafety.6-dev
+## 1.16.0-nullsafety.6
+
+* Add `markTestSkipped` API.
 
 ## 1.16.0-nullsafety.5
 
diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml
index b2d3d27..ac3160c 100644
--- a/pkgs/test/pubspec.yaml
+++ b/pkgs/test/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test
-version: 1.16.0-nullsafety.6-dev
+version: 1.16.0-nullsafety.6
 description: A full featured library for writing and running Dart tests.
 homepage: https://github.com/dart-lang/test/blob/master/pkgs/test
 
@@ -32,8 +32,8 @@
   webkit_inspection_protocol: ">=0.5.0 <0.8.0"
   yaml: ^2.0.0
   # Use an exact version until the test_api and test_core package are stable.
-  test_api: 0.2.19-nullsafety.2
-  test_core: 0.3.12-nullsafety.5
+  test_api: 0.2.19-nullsafety.3
+  test_core: 0.3.12-nullsafety.6
 
 dev_dependencies:
   fake_async: ^1.0.0
diff --git a/pkgs/test/test/runner/skip_expect_test.dart b/pkgs/test/test/runner/skip_expect_test.dart
index bce0e03..d342511 100644
--- a/pkgs/test/test/runner/skip_expect_test.dart
+++ b/pkgs/test/test/runner/skip_expect_test.dart
@@ -117,6 +117,96 @@
     });
   });
 
+  group('markTestSkipped', () {
+    test('prints the skip reason', () async {
+      await d.file('test.dart', '''
+        import 'package:test/test.dart';
+
+        void main() {
+          test('skipped', () {
+            markTestSkipped('some reason');
+          });
+        }
+      ''').create();
+
+      var test = await runTest(['test.dart']);
+      expect(
+          test.stdout,
+          containsInOrder([
+            '+0: skipped',
+            '  some reason',
+            '~1: All tests skipped.',
+          ]));
+      await test.shouldExit(0);
+    });
+
+    test('still allows the test to fail', () async {
+      await d.file('test.dart', '''
+        import 'package:test/test.dart';
+
+        void main() {
+          test('failing', () {
+            markTestSkipped('some reason');
+            expect(1, equals(2));
+          });
+        }
+      ''').create();
+
+      var test = await runTest(['test.dart']);
+      expect(
+          test.stdout,
+          containsInOrder([
+            '+0: failing',
+            '  some reason',
+            '+0 -1: failing [E]',
+            '  Expected: <2>',
+            '    Actual: <1>',
+            '+0 -1: Some tests failed.'
+          ]));
+      await test.shouldExit(1);
+    });
+
+    test('error when called after the test succeeded', () async {
+      await d.file('test.dart', '''
+        import 'dart:async';
+
+        import 'package:test/test.dart';
+
+        void main() {
+          var skipCompleter = Completer();
+          var waitCompleter = Completer();
+          test('skip', () {
+            skipCompleter.future.then((_) {
+              waitCompleter.complete();
+              markTestSkipped('some reason');
+            });
+          });
+
+          // Trigger the skip completer in a following test to ensure that it
+          // only fires after skip has completed successfully.
+          test('wait', () async {
+            skipCompleter.complete();
+            await waitCompleter.future;
+          });
+        }
+      ''').create();
+
+      var test = await runTest(['test.dart']);
+      expect(
+          test.stdout,
+          containsInOrder([
+            '+0: skip',
+            '+1: wait',
+            '+0 -1: skip',
+            'This test was marked as skipped after it had already completed. '
+                'Make sure to use',
+            '[expectAsync] or the [completes] matcher when testing async code.',
+            '+1 -1: Some tests failed.'
+          ]));
+      await test.shouldExit(1);
+    });
+  });
+
   group('errors', () {
     test('when called after the test succeeded', () async {
       await d.file('test.dart', '''
diff --git a/pkgs/test_api/CHANGELOG.md b/pkgs/test_api/CHANGELOG.md
index 44627be..11159cd 100644
--- a/pkgs/test_api/CHANGELOG.md
+++ b/pkgs/test_api/CHANGELOG.md
@@ -1,6 +1,7 @@
-## 0.2.19-nullsafety.3-dev
+## 0.2.19-nullsafety.3
 
 * Add capability to filter to a single exact test name in `Declarer`.
+* Add `markTestSkipped` API.
 
 ## 0.2.19-nullsafety.2
 
diff --git a/pkgs/test_api/lib/test_api.dart b/pkgs/test_api/lib/test_api.dart
index 87de20c..1857896 100644
--- a/pkgs/test_api/lib/test_api.dart
+++ b/pkgs/test_api/lib/test_api.dart
@@ -287,3 +287,10 @@
 /// [print], each individual message passed to [printOnFailure] will be
 /// separated by a blank line.
 void printOnFailure(String message) => Invoker.current!.printOnFailure(message);
+
+/// Marks the current test as skipped.
+///
+/// A skipped test may still fail if any exception is thrown, including uncaught
+/// asynchronous errors. If the entire test should be skipped `return` from the
+/// test body after marking it as skipped.
+void markTestSkipped(String message) => Invoker.current!.skip(message);
diff --git a/pkgs/test_api/pubspec.yaml b/pkgs/test_api/pubspec.yaml
index a7ec95c..dc3c7ab 100644
--- a/pkgs/test_api/pubspec.yaml
+++ b/pkgs/test_api/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test_api
-version: 0.2.19-nullsafety.3-dev
+version: 0.2.19-nullsafety.3
 description: A library for writing Dart tests.
 homepage: https://github.com/dart-lang/test/blob/master/pkgs/test_api
 
diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md
index 1daf214..070b0e5 100644
--- a/pkgs/test_core/CHANGELOG.md
+++ b/pkgs/test_core/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 0.3.12-nullsafety.6-dev
+## 0.3.12-nullsafety.6
 
 * Add experimental `directRunTests`, `directRunSingle`, and `enumerateTestCases`
   APIs to enable test runners written around a single executable that can report
diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml
index e139861..bc9cc5f 100644
--- a/pkgs/test_core/pubspec.yaml
+++ b/pkgs/test_core/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test_core
-version: 0.3.12-nullsafety.6-dev
+version: 0.3.12-nullsafety.6
 description: A basic library for writing tests and running them on the VM.
 homepage: https://github.com/dart-lang/test/blob/master/pkgs/test_core