Skip to content

Commit f7b735f

Browse files
committed
fix: tests
1 parent cc9e359 commit f7b735f

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

test/src/commands/create/create_subcommand_test.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,9 +1065,12 @@ Run "runner help" to see global options.''';
10651065
'throws UsageException when the config template is not allowed',
10661066
() async {
10671067
final cwd = Directory.current;
1068-
addTearDown(() => Directory.current = cwd);
10691068
final tempDirectory = Directory.systemTemp.createTempSync();
1070-
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1069+
addTearDown(() {
1070+
tempDirectory.deleteSync(recursive: true);
1071+
Directory.current = cwd;
1072+
});
1073+
10711074
File(
10721075
path.join(tempDirectory.path, veryGoodConfigFileName),
10731076
).writeAsStringSync('create:\n template: unknown');
@@ -1267,7 +1270,10 @@ Run "runner help" to see global options.''';
12671270

12681271
test('applies config values loaded from very_good.yaml', () async {
12691272
final tempDirectory = Directory.systemTemp.createTempSync();
1270-
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1273+
addTearDown(() {
1274+
Directory.current = cwd;
1275+
tempDirectory.deleteSync(recursive: true);
1276+
});
12711277
File(
12721278
path.join(tempDirectory.path, veryGoodConfigFileName),
12731279
).writeAsStringSync('create:\n org_name: com.very.good');
@@ -1297,7 +1303,10 @@ Run "runner help" to see global options.''';
12971303
'when very_good.yaml is malformed',
12981304
() async {
12991305
final tempDirectory = Directory.systemTemp.createTempSync();
1300-
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1306+
addTearDown(() {
1307+
Directory.current = cwd;
1308+
tempDirectory.deleteSync(recursive: true);
1309+
});
13011310
File(
13021311
path.join(tempDirectory.path, veryGoodConfigFileName),
13031312
).writeAsStringSync('- not\n- a\n- map');

0 commit comments

Comments
 (0)