Skip to content

Commit e1f66f7

Browse files
committed
Fix tests.
1 parent 354589b commit e1f66f7

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

pkgs/dart_mcp_server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ For more information, see the official VS Code documentation for
160160
| `run_tests` | Run tests | Run Dart or Flutter tests with an agent centric UX. ALWAYS use instead of `dart test` or `flutter test` shell commands. |
161161
| `set_widget_selection_mode` | Set Widget Selection Mode | Enables or disables widget selection mode in the active Flutter application. Requires "connect_dart_tooling_daemon" to be successfully called first. This is not necessary when using flutter driver, only use it when you want the user to select a widget. |
162162
| `signature_help` | Signature help | Get signature help for an API being used at a given cursor position in a file. |
163-
| `stop_app` | | Kills a running Flutter process started by the launch_app tool. |
163+
| `stop_app` | | Stops a running Flutter process started by the launch_app tool. |
164164

165165
<!-- generated -->

pkgs/dart_mcp_server/test/tools/flutter_launcher_test.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void main() {
318318
'test-device',
319319
],
320320
stderr: 'Something went wrong',
321-
exitCode: Future.value(1),
321+
exitCode: 1,
322322
),
323323
);
324324
final serverAndClient = await createServerAndClient(
@@ -543,7 +543,10 @@ void main() {
543543
);
544544

545545
test.expect(result.structuredContent, {'success': true});
546-
test.expect(mockProcessManager.killedPids, [11111, 22222, processPid]);
546+
test.expect(mockProcessManager.killedPids, [
547+
if (Platform.isLinux) ...[11111, 22222],
548+
processPid,
549+
]);
547550
test.expect(result.isError, test.isNot(true));
548551
await server.shutdown();
549552
await client.shutdown();
@@ -697,7 +700,7 @@ class Command {
697700
final List<String> command;
698701
final String? stdout;
699702
final String? stderr;
700-
final Future<int>? exitCode;
703+
final int? exitCode;
701704
final int pid;
702705

703706
Command(
@@ -754,7 +757,9 @@ class MockProcessManager implements ProcessManager {
754757
stdout: Stream.value(utf8.encode(mockCommand.stdout ?? '')),
755758
stderr: Stream.value(utf8.encode(mockCommand.stderr ?? '')),
756759
pid: pid,
757-
exitCodeFuture: mockCommand.exitCode,
760+
exitCodeFuture: mockCommand.exitCode != null
761+
? Future(() => mockCommand.exitCode!)
762+
: null,
758763
);
759764
runningProcesses[pid] = process;
760765
return process;
@@ -781,7 +786,7 @@ class MockProcessManager implements ProcessManager {
781786
final mockCommand = _findCommand(command);
782787
return ProcessResult(
783788
mockCommand.pid,
784-
await (mockCommand.exitCode ?? Future.value(0)),
789+
mockCommand.exitCode ?? 0,
785790
mockCommand.stdout ?? '',
786791
mockCommand.stderr ?? '',
787792
);
@@ -804,7 +809,7 @@ class MockProcessManager implements ProcessManager {
804809
final mockCommand = _findCommand(command);
805810
return ProcessResult(
806811
mockCommand.pid,
807-
0,
812+
mockCommand.exitCode ?? 0,
808813
mockCommand.stdout ?? '',
809814
mockCommand.stderr ?? '',
810815
);

0 commit comments

Comments
 (0)