Skip to content
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
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/browser/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:pedantic/pedantic.dart';
import 'package:stack_trace/stack_trace.dart';
import 'package:typed_data/typed_data.dart';

Expand Down Expand Up @@ -134,7 +135,7 @@ abstract class Browser {
// For example this happens with Chrome Headless.
// See SDK issue: https://github.com/dart-lang/sdk/issues/31264
for (var stream in _ioSubscriptions) {
stream.cancel();
unawaited(stream.cancel());
}

(await _process).kill();
Expand Down
5 changes: 3 additions & 2 deletions pkgs/test/lib/src/runner/browser/chrome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:io';

import 'package:pedantic/pedantic.dart';
import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports
import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
import 'browser.dart';
Expand Down Expand Up @@ -72,8 +73,8 @@ class Chrome extends Browser {
remoteDebuggerCompleter.complete(null);
}

process.exitCode
.then((_) => Directory(dir).deleteSync(recursive: true));
unawaited(process.exitCode
.then((_) => Directory(dir).deleteSync(recursive: true)));

return process;
};
Expand Down
4 changes: 3 additions & 1 deletion pkgs/test/lib/src/runner/browser/firefox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:pedantic/pedantic.dart';

import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports
import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
Expand Down Expand Up @@ -46,7 +47,8 @@ class Firefox extends Browser {
..addAll(settings.arguments),
environment: {"MOZ_CRASHREPORTER_DISABLE": "1"});

process.exitCode.then((_) => Directory(dir).deleteSync(recursive: true));
unawaited(process.exitCode
.then((_) => Directory(dir).deleteSync(recursive: true)));

return process;
}
Expand Down
5 changes: 3 additions & 2 deletions pkgs/test/lib/src/runner/browser/phantom_js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:pedantic/pedantic.dart';

import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports

Expand Down Expand Up @@ -67,14 +68,14 @@ class PhantomJS extends Browser {
// don't drain its stdout stream it can deadlock.
process.stdout.listen((_) {});

process.exitCode.then((exitCode) {
unawaited(process.exitCode.then((exitCode) {
Directory(dir).deleteSync(recursive: true);

if (exitCode == exit_codes.protocol) {
throw ApplicationException(
"Only PhantomJS version 2.0.0 or greater is supported");
}
});
}));

if (port != null) {
remoteDebuggerCompleter.complete(Uri.parse(
Expand Down
4 changes: 3 additions & 1 deletion pkgs/test/lib/src/runner/browser/safari.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:convert';
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:pedantic/pedantic.dart';

import 'package:test_api/src/backend/runtime.dart'; // ignore: implementation_imports
import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
Expand Down Expand Up @@ -40,7 +41,8 @@ class Safari extends Browser {
var process = await Process.start(
settings.executable, settings.arguments.toList()..add(redirect));

process.exitCode.then((_) => Directory(dir).deleteSync(recursive: true));
unawaited(process.exitCode
.then((_) => Directory(dir).deleteSync(recursive: true)));

return process;
}
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/node/platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'dart:convert';
import 'package:async/async.dart';
import 'package:multi_server_socket/multi_server_socket.dart';
import 'package:node_preamble/preamble.dart' as preamble;
import 'package:pedantic/pedantic.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:package_resolver/package_resolver.dart';
import 'package:path/path.dart' as p;
Expand Down Expand Up @@ -130,7 +131,7 @@ class NodePlatform extends PlatformPlugin

return Pair(channel, pair.last);
} catch (_) {
server.close().catchError((_) {});
unawaited(server.close().catchError((_) {}));
rethrow;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
node_preamble: '^1.3.0'
package_resolver: '^1.0.0'
path: '^1.2.0'
pedantic: '^1.1.0'
pool: '^1.3.0'
pub_semver: '^1.0.0'
shelf: '>=0.6.5 <0.8.0'
Expand All @@ -37,7 +38,6 @@ dependencies:

dev_dependencies:
fake_async: '>=0.1.2 <2.0.0'
pedantic: '1.1.0'
shelf_test_handler: '^1.0.0'
test_descriptor: '^1.0.0'
test_process: '^1.0.0'
Expand Down
11 changes: 6 additions & 5 deletions pkgs/test/test/runner/configuration/top_level_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import 'dart:async';
import 'dart:convert';

import 'package:path/path.dart' as p;
import 'package:test_descriptor/test_descriptor.dart' as d;

import 'package:test_core/src/util/io.dart';
import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';
import 'package:test_core/src/util/io.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

import '../../io.dart';

Expand Down Expand Up @@ -82,10 +82,11 @@ void main() {
]));

var nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {

unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+0: success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/test/runner/expanded_reporter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void main() {
}

Future _expectReport(String tests, String expected, {List<String> args}) async {
d.file("test.dart", """
await d.file("test.dart", """
import 'dart:async';

import 'package:test/test.dart';
Expand Down
32 changes: 16 additions & 16 deletions pkgs/test/test/runner/pause_after_load_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import 'dart:async';
import 'dart:io';

import 'package:test_descriptor/test_descriptor.dart' as d;

import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

import '../io.dart';

Expand Down Expand Up @@ -46,10 +46,10 @@ void main() {
""")));

var nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+0: test1.dart: success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand All @@ -66,10 +66,10 @@ void main() {
""")));

nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+1: test2.dart: success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand Down Expand Up @@ -112,10 +112,10 @@ void main() {
""")));

var nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+0: [Firefox] success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand All @@ -134,10 +134,10 @@ void main() {
])));

nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+1: [Chrome] success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand All @@ -155,10 +155,10 @@ void main() {
])));

nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+2: [VM] success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand Down Expand Up @@ -244,10 +244,10 @@ void main() {
""")));

var nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+0: success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand Down Expand Up @@ -284,10 +284,10 @@ void main() {
""")));

var nextLineFired = false;
test.stdout.next.then(expectAsync1((line) {
unawaited(test.stdout.next.then(expectAsync1((line) {
expect(line, contains("+0: success"));
nextLineFired = true;
}));
})));

// Wait a little bit to be sure that the tests don't start running without
// our input.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/test/test/runner/pub_serve_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void main() {
containsInOrder(
[" main.<fn>", "package:test", "dart:async/zone.dart"]));
await test.shouldExit(1);
pub.kill();
await pub.kill();
}, tags: 'chrome');

test("on Node", () async {
Expand All @@ -235,7 +235,7 @@ void main() {
containsInOrder(
[" main.<fn>", "package:test", "dart:async/zone.dart"]));
await test.shouldExit(1);
pub.kill();
await pub.kill();
}, tags: 'node');
}, skip: 'Broken by sdk#32633');

Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/test/runner/retry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void main() {
});

test("respects top-level @Retry declarations", () async {
d.file("test.dart", """
await d.file("test.dart", """
@Retry(3)

import 'dart:async';
Expand Down
5 changes: 3 additions & 2 deletions pkgs/test_api/lib/src/backend/invoker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';

import 'package:pedantic/pedantic.dart';
import 'package:stack_trace/stack_trace.dart';

import '../frontend/expect.dart';
Expand Down Expand Up @@ -395,11 +396,11 @@ class Invoker {
//
// Using [new Future] also avoids starving the DOM or other
// microtask-level events.
Future(() async {
unawaited(Future(() async {
await _test._body();
await unclosable(_runTearDowns);
removeOutstandingCallback();
});
}));

await _outstandingCallbacks.noOutstandingCallbacks;
if (_timeoutTimer != null) _timeoutTimer.cancel();
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test_api/lib/src/frontend/stream_matcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';

import 'package:async/async.dart';
import 'package:matcher/matcher.dart';
import 'package:pedantic/pedantic.dart';

import '../utils.dart';
import 'async_matcher.dart';
Expand Down Expand Up @@ -156,7 +157,7 @@ class _StreamMatcher extends AsyncMatcher implements StreamMatcher {

// Wait on a timer tick so all buffered events are emitted.
await Future.delayed(Duration.zero);
subscription.cancel();
unawaited(subscription.cancel());

var eventsString = events.map((event) {
if (event == null) {
Expand Down
1 change: 1 addition & 0 deletions pkgs/test_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
collection: '^1.8.0'
meta: '^1.1.5'
path: '^1.2.0'
pedantic: '^1.0.0'
source_span: '^1.4.0'
stack_trace: '^1.9.0'
stream_channel: '^1.6.0'
Expand Down
5 changes: 3 additions & 2 deletions pkgs/test_api/test/backend/invoker_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import 'dart:async';

import 'package:fake_async/fake_async.dart';
import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';
import 'package:test_api/src/backend/group.dart';
import 'package:test_api/src/backend/invoker.dart';
import 'package:test_api/src/backend/live_test.dart';
import 'package:test_api/src/backend/message.dart';
import 'package:test_api/src/backend/metadata.dart';
import 'package:test_api/src/backend/state.dart';
import 'package:test_api/src/backend/suite.dart';
import 'package:test/test.dart';

import '../utils.dart';

Expand Down Expand Up @@ -562,7 +563,7 @@ void main() {
]);

var isComplete = false;
liveTest.run().then((_) => isComplete = true);
unawaited(liveTest.run().then((_) => isComplete = true));
await pumpEventQueue();
expect(liveTest.state.status, equals(Status.complete));
expect(isComplete, isFalse);
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test_api/test/frontend/add_tear_down_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';

import 'package:async/async.dart';
import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';

import '../utils.dart';
Expand Down Expand Up @@ -750,7 +751,7 @@ void main() {
});

var queue = StreamQueue(engine.onTestStarted);
queue.skip(2);
unawaited(queue.skip(2));
var liveTestFuture = queue.next;

expect(await engine.run(), isFalse);
Expand Down
Loading