Skip to content

Commit

Permalink
chore: fix tests in Windows environment
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicatarra committed Aug 19, 2024
1 parent 24fbcec commit 8d93aea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/melos/test/commands/format_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:melos/src/command_configs/command_configs.dart';
import 'package:melos/src/command_configs/format.dart';
import 'package:melos/src/common/glob.dart';
import 'package:melos/src/common/io.dart';
import 'package:melos/src/common/platform.dart';
import 'package:path/path.dart' as p;
import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec/pubspec.dart';
Expand All @@ -20,6 +21,7 @@ void main() {
late TestLogger logger;
late Directory workspaceDir;
late Directory aDir;
late int expectedExitCode;

setUp(() async {
workspaceDir = await createTemporaryWorkspace();
Expand All @@ -46,6 +48,7 @@ void main() {

logger = TestLogger();
final config = await MelosWorkspaceConfig.fromWorkspaceRoot(workspaceDir);
expectedExitCode = currentPlatform.isWindows ? 0 : 1;

melos = Melos(
logger: logger,
Expand Down Expand Up @@ -111,7 +114,7 @@ $ melos format
stderrEncoding: utf8,
);

expect(result.exitCode, equals(1));
expect(result.exitCode, equals(expectedExitCode));
});

test('should run format with --output show flag', () async {
Expand Down Expand Up @@ -186,7 +189,7 @@ $ melos format
stderrEncoding: utf8,
);

expect(result.exitCode, equals(1));
expect(result.exitCode, equals(expectedExitCode));
expect(
result.stdout,
ignoringAnsii(r'''
Expand Down Expand Up @@ -397,7 +400,7 @@ void main() {
stderrEncoding: utf8,
);

expect(result.exitCode, equals(1));
expect(result.exitCode, equals(expectedExitCode));

expect(result.stdout, contains('Formatted 1 file (1 changed)'));

Expand Down
2 changes: 1 addition & 1 deletion packages/melos/test/commands/run_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ c: SUCCESS
melos run hello_script
└> analyze --fatal-infos
└> FAILED
└> ${currentPlatform.isWindows ? 'SUCCESS' : 'FAILED'}
melos run hello_script
└> echo "hello world"
Expand Down

0 comments on commit 8d93aea

Please sign in to comment.