Skip to content

Commit

Permalink
Use dart_dev v2 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
evanweible-wf committed Oct 8, 2018
1 parent 1d7e4c1 commit 9cc5513
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 155 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ packages
pubspec.lock
.dart_tool
node_modules
/build/

# javascript
node_modules/
Expand Down
52 changes: 14 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,17 @@ cache:
directories:
- $HOME/.pub-cache

stages:
- quality
- test

jobs:
include:
- stage: quality
dart: 1.24.3
script:
- pub run dart_dev format --check
- dartanalyzer lib test tool
- cd example && pub get && dartanalyzer .; cd ..
- pub run dependency_validator -i build_runner,build_test,build_web_compilers,browser,coverage,dart_style --exclude-dir=example

- stage: quality
dart: dev
script:
- dartanalyzer lib test tool
- cd example && pub get && dartanalyzer .; cd ..
- pub run dependency_validator -i build_runner,build_test,build_web_compilers,browser,coverage,dart_style --exclude-dir=example

- stage: test
dart: 1.24.3
script: ./tool/travis.sh test:unit

- stage: test
dart: dev
script: ./tool/travis.sh test:unit

- stage: test
dart: 1.24.3
before_script: npm install
script: ./tool/travis.sh test:integration

- stage: test
dart: dev
before_script: npm install
script: ./tool/travis.sh test:integration
dart:
- 1.24.3
- stable

before_script:
- npm install

script:
- pub run dart_dev analyze
# - cd example && pub get && dartanalyzer .; cd ..
- pub run dart_dev dart2-only -- format --check
- pub run dependency_validator -i build_runner,build_test,build_web_compilers,coverage,dart_style --exclude-dir=example
- pub run dart_dev dart1-only -- test -P integration -P travis
- pub run dart_dev dart2-only -- test -P integration -P travis -P dart2
12 changes: 4 additions & 8 deletions dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@
#
# Run unit tests:
#
# $ pub run test
# $ pub run dart_dev test -P dart1
#
# Run integration tests:
#
# $ node tool/server/sockjs.js
# $ dart tool/server/server.dart
# $ pub run test -P integration
# $ pub run dart_dev test -P dart1 -P integration
#
#
# Dart 2:
# -------
#
# Run unit tests:
#
# $ pub run build_runner test
# $ pub run dart_dev test -P dart1
#
# Run integration tests:
#
# $ node tool/server/sockjs.js
# $ dart tool/server/server.dart
# $ pub run build_runner test -- -P integration
# $ pub run dart_dev test -P dart2 -P integration
platforms:
- chrome
- vm
Expand Down
1 change: 0 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version: 0.0.0
private: true

dev_dependencies:
browser: ^0.10.0+2
collection: ^1.14.6
over_react: ^1.24.0
w_transport:
Expand Down
3 changes: 2 additions & 1 deletion lib/src/http/common/request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,8 @@ abstract class CommonRequest extends Object
// Attempt to fetch the response.
// ignore: unawaited_futures
sendRequestAndFetchResponse(finalizedRequest,
streamResponse: streamResponse).then((response) {
streamResponse: streamResponse)
.then((response) {
if (!responseCompleter.isCompleted) {
responseCompleter.complete(response);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/web_socket/vm/web_socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class VMWebSocket extends CommonWebSocket implements WebSocket {
io.WebSocket webSocket;
bool wasSuccessful;
try {
webSocket = await io.WebSocket
.connect(uri.toString(), headers: headers, protocols: protocols);
webSocket = await io.WebSocket.connect(uri.toString(),
headers: headers, protocols: protocols);
wasSuccessful = true;
} on io.SocketException catch (e) {
wasSuccessful = false;
Expand Down
12 changes: 8 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ authors:
- Trent Grover <[email protected]>

environment:
sdk: '>=1.24.3<3.0.0'
sdk: '>=1.24.3 <3.0.0'

dependencies:
dart2_constant: ^1.0.1
Expand All @@ -32,14 +32,18 @@ dependencies:
sockjs_client_wrapper: ^1.0.5

dev_dependencies:
build_runner: ">=0.6.0 <1.0.0"
build_runner: ">=0.6.0 <2.0.0"
build_test: ">=0.9.0 <1.0.0"
build_web_compilers: ">=0.2.0 <1.0.0"
coverage: ">=0.10.0 <0.13.0"
# dart_dev: ^1.9.5
#dart_dev: ^2.0.0
dart_dev:
git:
url: git://github.com/Workiva/dart_dev.git
ref: 24496ae534d4bfdcd5a224f9249bda263e08ace7 # dart2
dart_style: ^1.0.8
dependency_validator: ^1.2.1
http_server: ^0.9.6
mockito: '>=2.0.2 <4.0.0'
mockito: ">=2.0.2 <4.0.0"
test: ">=0.12.30 <2.0.0"
uuid: ">=0.5.3 <2.0.0"
5 changes: 3 additions & 2 deletions test/integration/global_web_socket_monitor/browser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ void main() {

group(naming.toString(), () {
// ignore: deprecated_member_use
Future<transport.WebSocket> connect(Uri uri) => transport.WebSocket
.connect(uri, transportPlatform: browserTransportPlatform);
Future<transport.WebSocket> connect(Uri uri) =>
transport.WebSocket.connect(uri,
transportPlatform: browserTransportPlatform);

runCommonGlobalWebSocketMonitorIntegrationTests(connect);

Expand Down
5 changes: 3 additions & 2 deletions test/integration/global_web_socket_monitor/vm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ void main() {

group(naming.toString(), () {
// ignore: deprecated_member_use
Future<transport.WebSocket> connect(Uri uri) => transport.WebSocket
.connect(uri, transportPlatform: vmTransportPlatform);
Future<transport.WebSocket> connect(Uri uri) =>
transport.WebSocket.connect(uri,
transportPlatform: vmTransportPlatform);

runCommonGlobalWebSocketMonitorIntegrationTests(connect);

Expand Down
4 changes: 2 additions & 2 deletions test/unit/mocks/mock_http_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ void main() {
// ignore: unawaited_futures
transport.Http.get(Uri.parse('/wrong')); // Wrong URI.
await transport.Http.get(Uri.parse('https://google.com'));
await transport.Http
.get(Uri.parse('https://github.com/Workiva/w_transport'));
await transport.Http.get(
Uri.parse('https://github.com/Workiva/w_transport'));
expect(MockTransports.http.numPendingRequests, equals(1));

await MockTransports.reset();
Expand Down
8 changes: 4 additions & 4 deletions test/unit/mocks/mock_web_socket_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ void main() {
equals(webSocket));
expect(
// ignore: deprecated_member_use
await transport.WSocket
.connect(Uri.parse('ws://github.com/ws/listen')),
await transport.WSocket.connect(
Uri.parse('ws://github.com/ws/listen')),
equals(webSocket));

// Non-matching connection fails.
Expand All @@ -432,8 +432,8 @@ void main() {
MockTransports.webSocket.whenPattern(uriPattern, handler: handler);

// ignore: deprecated_member_use
await transport.WSocket
.connect(Uri.parse('ws://github.com/ws/listen'));
await transport.WSocket.connect(
Uri.parse('ws://github.com/ws/listen'));
expect(uriMatch.group(0), equals('ws://github.com/ws/listen'));
expect(uriMatch.group(1), equals('github'));
});
Expand Down
13 changes: 2 additions & 11 deletions tool/dev.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ Future<Null> main(List<String> args) async {
final directories = <String>['example/', 'lib/', 'test/', 'tool/'];

config.analyze.entryPoints = [
'example/',
'example/http/cross_origin_credentials/',
'example/http/cross_origin_file_transfer/',
'example/http/simple_client/',
'lib/',
'test/',
'test/unit/',
Expand All @@ -46,11 +42,6 @@ Future<Null> main(List<String> args) async {
..before = [_streamServer, _streamSockJSServer]
..after = [_stopServer, _stopSockJSServer];

config.examples
..port = 9000
..before = [_streamServer, _streamSockJSServer, _serveExamples]
..after = [_stopServer, _stopSockJSServer];

config.format.paths = directories;

config.test
Expand Down Expand Up @@ -87,8 +78,8 @@ List<String> _sockJSServerOutput;

Future<Null> _serveExamples() {
io.Process.runSync('pub', ['get'], workingDirectory: 'example');
io.Process
.start('pub', ['serve', '--port=9000'], workingDirectory: 'example');
io.Process.start('pub', ['serve', '--port=9000'],
workingDirectory: 'example');

return new Completer<Null>().future;
}
Expand Down
80 changes: 0 additions & 80 deletions tool/travis.sh

This file was deleted.

0 comments on commit 9cc5513

Please sign in to comment.