Skip to content

Commit 48b22bb

Browse files
authored
feat: Run tests on a windows CI as well
1 parent a3c7d37 commit 48b22bb

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.github/workflows/very_good_cli.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest]
16+
runs-on: ${{ matrix.os }}
1417

1518
steps:
1619
- uses: actions/checkout@v5

test/src/command_runner_test.dart

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ void main() {
194194

195195
stdout = _MockStdout();
196196
when(() => stdout.hasTerminal).thenReturn(true);
197-
when(() => stdout.supportsAnsiEscapes).thenReturn(true);
197+
198198
when(() => stdout.terminalColumns).thenReturn(30);
199+
200+
when(() => stdout.supportsAnsiEscapes).thenReturn(true);
199201
});
200202

201203
test('shows message when version changed', () async {
@@ -269,6 +271,32 @@ void main() {
269271
);
270272
});
271273

274+
test('fallback to HOME when XDG_CONFIG_HOME is null/empty', () async {
275+
commandRunner
276+
..environmentOverride = {
277+
'HOME': '/users/test',
278+
'XDG_CONFIG_HOME': '',
279+
}
280+
..isWindowsOverride = false;
281+
282+
final homeCache = _MockDirectory();
283+
when(() => homeCache.path).thenReturn('/users/test');
284+
285+
await IOOverrides.runZoned(
286+
() async {
287+
final result = await commandRunner.run([]);
288+
expect(result, equals(ExitCode.success.code));
289+
290+
verifyNever(() => cliCache.path);
291+
verify(() => homeCache.path).called(1);
292+
},
293+
createDirectory: (path) =>
294+
path.contains('test') ? homeCache : cliCache,
295+
createFile: (path) => versionFile,
296+
stdout: () => stdout,
297+
);
298+
});
299+
272300
test('cache inside local APP_DATA on windows', () async {
273301
commandRunner
274302
..environmentOverride = {'LOCALAPPDATA': '/C/Users/test'}

0 commit comments

Comments
 (0)