Pass --categories=Server to dart2js when compiling Node (#794)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8af2afd..9f7df23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,7 @@
-## 0.12.32+3
+## 0.12.33
+
+* Pass `--categories=Server` to `dart2js` when compiling tests for Node.js. This
+  tells it that `dart:html` is unavailable.
 
 * Don't crash when attempting to format stack traces when running via
   `dart path/to/test.dart`.
diff --git a/README.md b/README.md
index 733595c..88e6223 100644
--- a/README.md
+++ b/README.md
@@ -294,7 +294,9 @@
 The test runner looks for an executable named `node` (on Mac OS or Linux) or
 `node.exe` (on Windows) on your system path. When compiling Node.js tests, it
 passes `-Dnode=true`, so tests can determine whether they're running on Node
-using [`const bool.fromEnvironment("node")`][bool.fromEnvironment].
+using [`const bool.fromEnvironment("node")`][bool.fromEnvironment]. It also sets
+`--categories=Server`, which will tell the compiler that `dart:html` is not
+available.
 
 [bool.fromEnvironment]: https://api.dartlang.org/stable/1.24.2/dart-core/bool/bool.fromEnvironment.html
 
diff --git a/lib/src/runner/node/platform.dart b/lib/src/runner/node/platform.dart
index f832b58..17c1ae7 100644
--- a/lib/src/runner/node/platform.dart
+++ b/lib/src/runner/node/platform.dart
@@ -9,6 +9,7 @@
 import 'package:async/async.dart';
 import 'package:multi_server_socket/multi_server_socket.dart';
 import 'package:node_preamble/preamble.dart' as preamble;
+import 'package:pub_semver/pub_semver.dart';
 import 'package:package_resolver/package_resolver.dart';
 import 'package:path/path.dart' as p;
 import 'package:stream_channel/stream_channel.dart';
@@ -31,6 +32,10 @@
 import '../plugin/platform_helpers.dart';
 import '../runner_suite.dart';
 
+/// The first Dart SDK version where `--categories=Server` disables `dart:html`
+/// rather than disabling all JS-specific libraries.
+final _firstServerSdk = new Version.parse("2.0.0-dev.42.0");
+
 /// A platform that loads tests in Node.js processes.
 class NodePlatform extends PlatformPlugin
     implements CustomizablePlatform<ExecutableSettings> {
@@ -38,7 +43,11 @@
   final Configuration _config;
 
   /// The [CompilerPool] managing active instances of `dart2js`.
-  final _compilers = new CompilerPool(["-Dnode=true"]);
+  final _compilers = () {
+    var arguments = ["-Dnode=true"];
+    if (sdkVersion >= _firstServerSdk) arguments.add("--categories=Server");
+    return new CompilerPool(arguments);
+  }();
 
   /// The temporary directory in which compiled JS is emitted.
   final _compiledDir = createTempDir();
diff --git a/lib/src/util/io.dart b/lib/src/util/io.dart
index 7bfbb946..33ef577 100644
--- a/lib/src/util/io.dart
+++ b/lib/src/util/io.dart
@@ -10,6 +10,7 @@
 
 import 'package:async/async.dart';
 import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
 
 import '../backend/operating_system.dart';
 import '../backend/runtime.dart';
@@ -45,6 +46,9 @@
 /// The root directory of the Dart SDK.
 final String sdkDir = p.dirname(p.dirname(Platform.resolvedExecutable));
 
+/// The version of the Dart SDK on which test is running.
+final sdkVersion = new Version.parse(Platform.version.split(' ').first);
+
 /// Returns the current operating system.
 final OperatingSystem currentOS = (() {
   var name = Platform.operatingSystem;
diff --git a/pubspec.yaml b/pubspec.yaml
index fae28e6..358f4fd 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: test
-version: 0.12.33-dev
+version: 0.12.33
 author: Dart Team <misc@dartlang.org>
 description: A library for writing dart unit tests.
 homepage: https://github.com/dart-lang/test
diff --git a/test/runner/pub_serve_test.dart b/test/runner/pub_serve_test.dart
index 8e6be0c..84ab5c9 100644
--- a/test/runner/pub_serve_test.dart
+++ b/test/runner/pub_serve_test.dart
@@ -12,6 +12,7 @@
 import 'package:test_descriptor/test_descriptor.dart' as d;
 
 import 'package:test/src/util/exit_codes.dart' as exit_codes;
+import 'package:test/src/util/io.dart';
 import 'package:test/test.dart';
 
 import '../io.dart';
@@ -406,11 +407,7 @@
 
 /// Whether or not the dartdevc compiler is supported on the current
 /// [Platform.version].
-final bool _sdkSupportsDartDevc = () {
-  var sdkVersion = new Version.parse(Platform.version.split(' ').first);
-  var minDartDevcVersion = new Version(1, 24, 0);
-  return sdkVersion >= minDartDevcVersion;
-}();
+final bool _sdkSupportsDartDevc = sdkVersion >= new Version(1, 24, 0);
 
 /// Runs the test described by [testFn] once for each supported compiler on the
 /// current [Platform.version], passing the relevant compiler args for pub serve