Skip to content

Commit e6ae71a

Browse files
author
Jochum van der Ploeg
authored
fix(ci): unblock pipeline for windows (#1453)
1 parent befcd5b commit e6ae71a

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

packages/dart_frog_cli/e2e/test/daemon/daemon_domain_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void main() {
6363
);
6464
});
6565

66-
test('daemon process responds to unkown message type', () async {
66+
test('daemon process responds to unknown message type', () async {
6767
await daemonStdio.sendStringMessage('[{}]');
6868
final protocolError = await daemonStdio.awaitForDaemonEvent(
6969
'daemon.protocolError',
@@ -74,7 +74,7 @@ void main() {
7474
);
7575
});
7676

77-
test('daemon process responds to unkown message type', () async {
77+
test('daemon process responds to unknown message type', () async {
7878
await daemonStdio.sendStringMessage('[{"id": 0, "method": "foo.bar"}]');
7979
final protocolError = await daemonStdio.awaitForDaemonEvent(
8080
'daemon.protocolError',

packages/dart_frog_cli/e2e/test/dev_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ void main() {
8585

8686
fail('exception not thrown');
8787
} catch (e) {
88+
expect(e.toString(), contains('Could not start the VM service:'));
89+
8890
expect(
89-
e,
91+
e.toString(),
9092
contains(
91-
'''Could not start the VM service: localhost:8181 is already in use.''',
93+
'DartDevelopmentServiceException: Failed to create server socket',
9294
),
9395
);
96+
97+
expect(e.toString(), contains('127.0.0.1:8181'));
9498
}
9599
},
96100
);

packages/dart_frog_cli/e2e/test/helpers/dart_frog_daemon.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class DaemonStdioHelper {
6666
/// Awaits for a daemon event with the given [methodKey].
6767
Future<DaemonEvent> awaitForDaemonEvent(
6868
String methodKey, {
69-
Duration timeout = const Duration(seconds: 1),
69+
Duration timeout = _defaultTimeout,
7070
Matcher? withParamsThat,
7171
}) async {
7272
var wrappedMatcher = isA<DaemonEvent>()
@@ -91,7 +91,7 @@ class DaemonStdioHelper {
9191
/// Awaits for a daemon message that matches the given [messageMatcher].
9292
Future<DaemonMessage> awaitForDaemonMessage(
9393
Matcher messageMatcher, {
94-
Duration timeout = const Duration(seconds: 1),
94+
Duration timeout = _defaultTimeout,
9595
}) async {
9696
final wrappedMatcher = _MatchMessageToStdoutLine(messageMatcher);
9797

@@ -106,7 +106,7 @@ class DaemonStdioHelper {
106106
/// Awaits for a string message that matches the given [messageMatcher].
107107
Future<String> awaitForStringMessage(
108108
Matcher messageMatcher, {
109-
Duration timeout = const Duration(seconds: 1),
109+
Duration timeout = _defaultTimeout,
110110
}) async {
111111
messageMatchers.add(messageMatcher);
112112

@@ -116,15 +116,15 @@ class DaemonStdioHelper {
116116
}).firstOrNull;
117117

118118
if (existingItem case (final int itemIndex, final String itemValue)) {
119-
// if there is a matching message in the cache,
119+
// If there is a matching message in the cache,
120120
// remove all the previous messages from the cache and
121121
// return the matching message.
122122
_pastMessagesCache = _pastMessagesCache.skip(itemIndex + 1).toList();
123123
_clean(messageMatcher, null);
124124
return itemValue;
125125
}
126126

127-
// if there is no matching message in the cache,
127+
// If there is no matching message in the cache,
128128
// create a completer and wait for the message to be received
129129
// or for the timeout to expire.
130130

@@ -157,7 +157,7 @@ class DaemonStdioHelper {
157157
/// [TimeoutException] if the timeout expires.
158158
Future<DaemonResponse> sendDaemonRequest(
159159
DaemonRequest request, {
160-
Duration timeout = const Duration(seconds: 10),
160+
Duration timeout = _defaultTimeout,
161161
}) async {
162162
final json = jsonEncode(request.toJson());
163163

@@ -183,7 +183,7 @@ class DaemonStdioHelper {
183183
/// [TimeoutException] if the timeout expires.
184184
Future<(DaemonResponse, DaemonResponse)> sendStaggeredDaemonRequest(
185185
(DaemonRequest, DaemonRequest) requests, {
186-
Duration timeout = const Duration(seconds: 10),
186+
Duration timeout = _defaultTimeout,
187187
}) async {
188188
final request1 = requests.$1;
189189
final request2 = requests.$2;
@@ -230,6 +230,8 @@ class DaemonStdioHelper {
230230
void dispose() {
231231
subscription.cancel();
232232
}
233+
234+
static const _defaultTimeout = Duration(seconds: 10);
233235
}
234236

235237
/// A matcher that matches a [DaemonMessage] to a daemon stdout line.

packages/dart_frog_cli/e2e/test/helpers/run_process.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Future<ProcessResult> runProcess(
1717
runInShell: runInShell,
1818
);
1919

20-
if (result.exitCode != 0) {
20+
if (result.exitCode != 0 || _isNotEmpty(result.stderr)) {
2121
final commandLine = [executable, ...arguments].join(' ');
2222

2323
throw RunProcessException(
@@ -29,6 +29,12 @@ Future<ProcessResult> runProcess(
2929
return result;
3030
}
3131

32+
bool _isNotEmpty(dynamic data) {
33+
if (data is String) return data.isNotEmpty;
34+
if (data is List) return data.isNotEmpty;
35+
return false;
36+
}
37+
3238
class RunProcessException implements Exception {
3339
RunProcessException(
3440
this.message, {

0 commit comments

Comments
 (0)