2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'dart:io' ;
6
+
5
7
import 'package:dart_mcp/server.dart' ;
6
8
import 'package:dart_mcp_server/src/mixins/dash_cli.dart' ;
7
9
import 'package:dart_mcp_server/src/utils/constants.dart' ;
@@ -15,6 +17,8 @@ void main() {
15
17
late TestProcessManager testProcessManager;
16
18
late Root exampleFlutterAppRoot;
17
19
late Root dartCliAppRoot;
20
+ final dartExecutableName = 'dart${Platform .isWindows ? '.exe' : '' }' ;
21
+ final flutterExecutableName = 'flutter${Platform .isWindows ? '.bat' : '' }' ;
18
22
19
23
// TODO: Use setUpAll, currently this fails due to an apparent TestProcess
20
24
// issue.
@@ -76,7 +80,7 @@ dependencies:
76
80
expect (result.isError, isNot (true ));
77
81
expect (testProcessManager.commandsRan, [
78
82
equalsCommand ((
79
- command: [endsWith ('dart' ), 'fix' , '--apply' ],
83
+ command: [endsWith (dartExecutableName ), 'fix' , '--apply' ],
80
84
workingDirectory: exampleFlutterAppRoot.path,
81
85
)),
82
86
]);
@@ -98,7 +102,7 @@ dependencies:
98
102
expect (result.isError, isNot (true ));
99
103
expect (testProcessManager.commandsRan, [
100
104
equalsCommand ((
101
- command: [endsWith ('dart' ), 'format' , '.' ],
105
+ command: [endsWith (dartExecutableName ), 'format' , '.' ],
102
106
workingDirectory: exampleFlutterAppRoot.path,
103
107
)),
104
108
]);
@@ -123,7 +127,12 @@ dependencies:
123
127
expect (result.isError, isNot (true ));
124
128
expect (testProcessManager.commandsRan, [
125
129
equalsCommand ((
126
- command: [endsWith ('dart' ), 'format' , 'foo.dart' , 'bar.dart' ],
130
+ command: [
131
+ endsWith (dartExecutableName),
132
+ 'format' ,
133
+ 'foo.dart' ,
134
+ 'bar.dart' ,
135
+ ],
127
136
workingDirectory: exampleFlutterAppRoot.path,
128
137
)),
129
138
]);
@@ -155,15 +164,15 @@ dependencies:
155
164
expect (testProcessManager.commandsRan, [
156
165
equalsCommand ((
157
166
command: [
158
- endsWith ('flutter' ),
167
+ endsWith (flutterExecutableName ),
159
168
'test' ,
160
169
'foo_test.dart' ,
161
170
'bar_test.dart' ,
162
171
],
163
172
workingDirectory: exampleFlutterAppRoot.path,
164
173
)),
165
174
equalsCommand ((
166
- command: [endsWith ('dart' ), 'test' , 'zip_test.dart' ],
175
+ command: [endsWith (dartExecutableName ), 'test' , 'zip_test.dart' ],
167
176
workingDirectory: dartCliAppRoot.path,
168
177
)),
169
178
]);
@@ -186,7 +195,7 @@ dependencies:
186
195
expect (testProcessManager.commandsRan, [
187
196
equalsCommand ((
188
197
command: [
189
- endsWith ('dart' ),
198
+ endsWith (dartExecutableName ),
190
199
'create' ,
191
200
'--template' ,
192
201
'cli' ,
@@ -213,7 +222,7 @@ dependencies:
213
222
expect (testProcessManager.commandsRan, [
214
223
equalsCommand ((
215
224
command: [
216
- endsWith ('flutter' ),
225
+ endsWith (flutterExecutableName ),
217
226
'create' ,
218
227
'--template' ,
219
228
'app' ,
@@ -243,7 +252,7 @@ dependencies:
243
252
expect (testProcessManager.commandsRan, [
244
253
equalsCommand ((
245
254
command: [
246
- endsWith ('flutter' ),
255
+ endsWith (flutterExecutableName ),
247
256
'create' ,
248
257
'--template' ,
249
258
'app' ,
0 commit comments