Skip to content

Fix node bootstrapping for dart2 #811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 9 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ sudo: required
dist: trusty

dart:
- stable
- dev

env: FORCE_TEST_EXIT=true DARTIUM_EXPIRATION_TIME=1550044800LL
env: FORCE_TEST_EXIT=true

# Content shell needs these fonts.
addons:
Expand Down Expand Up @@ -38,45 +38,14 @@ before_install:
- ln -s `pwd`/`echo drt-linux-*`/content_shell bin/content_shell

dart_task:
# Browser tests take particularly long on Dartium, so we split them up into different tasks.
- test: --platform dartium
install_dartium: true

- dartfmt
- dartanalyzer
# Split the tests into five shards to help parallelize them across Travis workers.
- test: --preset travis --total-shards 5 --shard-index 0
install_dartium: true
- test: --preset travis --total-shards 5 --shard-index 1
install_dartium: true
- test: --preset travis --total-shards 5 --shard-index 2
install_dartium: true
- test: --preset travis --total-shards 5 --shard-index 3
install_dartium: true
- test: --preset travis --total-shards 5 --shard-index 4
install_dartium: true

matrix:
include:
# Browser tests take particularly long, so we split them up into different tasks.
- dart: dev
dart_task: {test: --platform chrome}

# Split the tests into five shards to help parallelize them across Travis workers.
# Don't run Dartium tests on dev because 2.0.0 doesn't support Dartium anymore.
- dart: dev
dart_task: {test: --preset travis --total-shards 5 --shard-index 0 -x dartium}
- dart: dev
dart_task: {test: --preset travis --total-shards 5 --shard-index 1 -x dartium}
- dart: dev
dart_task: {test: --preset travis --total-shards 5 --shard-index 2 -x dartium}
- dart: dev
dart_task: {test: --preset travis --total-shards 5 --shard-index 3 -x dartium}
- dart: dev
dart_task: {test: --preset travis --total-shards 5 --shard-index 4 -x dartium}

- dart: dev
dart_task: dartfmt
- dart: dev
dart_task: dartanalyzer
- test: --preset travis --total-shards 5 --shard-index 0 -x dartium
- test: --preset travis --total-shards 5 --shard-index 1 -x dartium
- test: --preset travis --total-shards 5 --shard-index 2 -x dartium
- test: --preset travis --total-shards 5 --shard-index 3 -x dartium
- test: --preset travis --total-shards 5 --shard-index 4 -x dartium

# Only building master means that we don't run two builds for each pull request.
branches:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## 0.12.34+1
## 0.12.35

* Dropped support for Dart 1. Going forward only Dart 2 will be supported.
* If you experience blocking issues and are still on the Dart 1 sdk, we will
consider bug fixes on a per-case basis based on severity and impact.
* Fixed an issue `--precompiled` node tests in subdirectories.
* Fixed some dart2 issues with node test bootstrapping code so that dartdevc
tests can run.
* Fixed default custom html handler so it correctly includes the
packages/test/dart.js file. This allows you to get proper errors instead of
timeouts if there are load exceptions in the browser.
Expand Down
1 change: 0 additions & 1 deletion dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ tags:
firefox: {add_tags: [dart2js]}
chrome: {add_tags: [dart2js]}
phantomjs: {add_tags: [dart2js]}
dartium: {add_tags: [browser]}

safari:
add_tags: [dart2js]
Expand Down
2 changes: 1 addition & 1 deletion lib/src/bootstrap/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "../util/stack_trace_mapper.dart";
void internalBootstrapNodeTest(Function getMain()) {
var channel = serializeSuite(getMain, beforeLoad: () async {
var serialized = await suiteChannel("test.node.mapper").stream.first;
if (serialized == null) return;
if (serialized == null || serialized is! Map) return;
setStackTraceMapper(StackTraceMapper.deserialize(serialized));
});
socketChannel().pipe(channel);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/runner/node/socket_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class _Socket {

/// Returns a [StreamChannel] of JSON-encodable objects that communicates over a
/// socket whose port is given by `process.argv[2]`.
StreamChannel socketChannel() {
StreamChannel<Object> socketChannel() {
var controller = new StreamChannelController<String>(
allowForeignErrors: false, sync: true);
var net = _require("net");
Expand Down
4 changes: 2 additions & 2 deletions lib/src/runner/remote_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class RemoteListener {
// This has to be synchronous to work around sdk#25745. Otherwise, there'll
// be an asynchronous pause before a syntax error notification is sent,
// which will cause the send to fail entirely.
var controller =
new StreamChannelController(allowForeignErrors: false, sync: true);
var controller = new StreamChannelController<Object>(
allowForeignErrors: false, sync: true);
var channel = new MultiChannel(controller.local);

var verboseChain = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/util/stack_trace_mapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class StackTraceMapper {
sdkRoot: Uri.parse(serialized['sdkRoot']),
packageResolver: packageRoot.isNotEmpty
? new SyncPackageResolver.root(Uri.parse(serialized['packageRoot']))
: new SyncPackageResolver.config(
_deserializePackageConfigMap(serialized['packageConfigMap'])),
: new SyncPackageResolver.config(_deserializePackageConfigMap(
serialized['packageConfigMap'].cast<String, String>())),
mapUrl: Uri.parse(serialized['mapUrl']));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final lineSplitter = new StreamTransformer<List<int>, String>(
///
/// Note that this is only safe for channels whose messages are guaranteed not
/// to contain newlines.
final chunksToLines = new StreamChannelTransformer(
final chunksToLines = new StreamChannelTransformer<String, String>(
const LineSplitter(),
new StreamSinkTransformer.fromHandlers(
handleData: (data, sink) => sink.add("$data\n")));
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: test
version: 0.12.34+1
version: 0.12.35
author: Dart Team <[email protected]>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/test
environment:
sdk: '>=1.24.0 <2.0.0'
sdk: '>=2.0.0-dev.22.0 <2.0.0'
dependencies:
analyzer: '>=0.26.4 <0.32.0'
args: '>=0.13.1 <2.0.0'
Expand Down