Skip to content

Commit 3d54ef7

Browse files
committed
Fix CI after merge
* don't collect test result for example app, there are no test atm * remove usage of `unawaited` - pedantic is deprecated and the new `unawait` from the Dart SDK required Dart 2.14 which would raise the min SDK for the library * try to prevent test not completing with Dart 2.12 because of a a wrong expectation on a `Future` - use `expectLater` instead * re-add example test which got lost in the merge
1 parent f14d442 commit 3d54ef7

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- [ ] I have read the [Documentation](https://pub.dartlang.org/packages/dio)
44
- [ ] I have searched for a similar pull request in the [project](https://github.com/flutterchina/dio/pulls) and found none
5-
- [ ] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
5+
- [ ] I have updated this branch with the latest `develop` to avoid conflicts (via merge from master or rebase)
66
- [ ] I have added the required tests to prove the fix/feature I am adding
77
- [ ] I have updated the documentation (if necessary)
88
- [ ] I have run the tests and they pass

.github/workflows/test-report.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name: Test Report
1+
name: Publish Test Report
22

33
on:
44
workflow_run:
55
workflows:
66
- Integration
77
- Example
8-
- Example App
98
types:
109
- completed
1110

dio/lib/src/adapters/browser_adapter.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import 'dart:async';
22
import 'dart:convert';
3+
import 'dart:html';
34
import 'dart:typed_data';
4-
import '../dio_error.dart';
5-
import '../options.dart';
5+
66
import '../adapter.dart';
7-
import 'dart:html';
7+
import '../dio_error.dart';
88
import '../headers.dart';
9+
import '../options.dart';
910

1011
HttpClientAdapter createAdapter() => BrowserHttpClientAdapter();
1112

@@ -47,7 +48,7 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
4748

4849
var completer = Completer<ResponseBody>();
4950

50-
unawaited(xhr.onLoad.first.then((_) {
51+
xhr.onLoad.first.then((_) {
5152
Uint8List body = (xhr.response as ByteBuffer).asUint8List();
5253
completer.complete(
5354
ResponseBody.fromBytes(
@@ -58,7 +59,7 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
5859
isRedirect: xhr.status == 302 || xhr.status == 301,
5960
),
6061
);
61-
}));
62+
});
6263

6364
bool haveSent = false;
6465

@@ -134,7 +135,7 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
134135
}
135136
});
136137

137-
unawaited(xhr.onError.first.then((_) {
138+
xhr.onError.first.then((_) {
138139
// Unfortunately, the underlying XMLHttpRequest API doesn't expose any
139140
// specific information about the error itself.
140141
completer.completeError(
@@ -145,17 +146,17 @@ class BrowserHttpClientAdapter implements HttpClientAdapter {
145146
),
146147
StackTrace.current,
147148
);
148-
}));
149+
});
149150

150-
unawaited(cancelFuture?.then((_) {
151+
cancelFuture?.then((_) {
151152
if (xhr.readyState < 4 && xhr.readyState > 0) {
152153
try {
153154
xhr.abort();
154155
} catch (e) {
155156
// ignore
156157
}
157158
}
158-
}));
159+
});
159160

160161
if (requestStream != null) {
161162
var _completer = Completer<Uint8List>();

dio/test/basic_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@TestOn('vm')
55
import 'dart:async';
66
import 'dart:io';
7+
78
import 'package:dio/dio.dart';
89
import 'package:test/test.dart';
910

@@ -68,7 +69,8 @@ void main() {
6869

6970
test('#status error', () async {
7071
var dio = Dio()..options.baseUrl = 'http://httpbin.org/status/';
71-
expect(
72+
73+
await expectLater(
7274
dio.get('401').catchError((e) => throw e.response.statusCode as Object),
7375
throwsA(401),
7476
);

dio/test/readtimeout_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void main() {
5959

6060
dio.options
6161
..baseUrl = serverUrl.toString()
62-
..receiveTimeout= SLEEP_DURATION_AFTER_CONNECTION_ESTABLISHED - 1000;
62+
..receiveTimeout = SLEEP_DURATION_AFTER_CONNECTION_ESTABLISHED - 1000;
6363

6464
DioError error;
6565

example/test/example_test.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// ignore_for_file: unused_import
2+
3+
import 'package:dio_example/adapter.dart';
4+
import 'package:dio_example/cancel_request.dart';
5+
import 'package:dio_example/cookie_mgr.dart';
6+
import 'package:dio_example/custom_cache_interceptor.dart';
7+
import 'package:dio_example/dio.dart';
8+
import 'package:dio_example/download.dart';
9+
import 'package:dio_example/download_with_trunks.dart';
10+
import 'package:dio_example/extend_dio.dart';
11+
import 'package:dio_example/formdata.dart';
12+
import 'package:dio_example/generic.dart';
13+
import 'package:dio_example/http2_adapter.dart';
14+
import 'package:dio_example/options.dart';
15+
import 'package:dio_example/post_stream_and_bytes.dart';
16+
import 'package:dio_example/proxy.dart';
17+
import 'package:dio_example/queue_interceptors.dart';
18+
import 'package:dio_example/queued_interceptor_crsftoken.dart';
19+
import 'package:dio_example/request_interceptors.dart';
20+
import 'package:dio_example/response_interceptor.dart';
21+
import 'package:dio_example/test.dart';
22+
import 'package:dio_example/transformer.dart';
23+
import 'package:test/test.dart';
24+
25+
/// This test ensures that all examples are included in the compilation unit
26+
/// and have no compile errors during integration builds.
27+
///
28+
/// Otherwise this does nothing.
29+
void main() {
30+
test('dummy', () {});
31+
}

0 commit comments

Comments
 (0)