Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reportSavePath argument #398

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'dart:io';

import 'package:convenient_test_manager_dart/stores/global_config_store.dart';
import 'package:convenient_test_manager_dart/stores/worker_super_run_store.dart';
import 'package:get_it/get_it.dart';

abstract class FsService {
Future<String> getBaseDataDirectory() async =>
GlobalConfigStore.config.reportSavePath ??
'${await getTemporaryDirectory()}/ConvenientTest';

Future<String> getActiveSuperRunDataSubDirectory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:mobx/mobx.dart';

part 'global_config_store.freezed.dart';

part 'global_config_store.g.dart';

class GlobalConfigStore {
Expand All @@ -29,11 +28,15 @@ abstract class _GlobalConfig with Store {
@observable
String? runOnly;

@observable
String? reportSavePath;

_GlobalConfig({
required this.isolationMode,
required this.enableReportSaver,
required this.goldenDiffGitRepo,
required this.runOnly,
required this.reportSavePath,
});
}

Expand All @@ -46,6 +49,7 @@ class GlobalConfigNullable with _$GlobalConfigNullable {
bool? enableReportSaver,
String? goldenDiffGitRepo,
String? runOnly,
String? reportSavePath,
}) = _GlobalConfigNullable;

factory GlobalConfigNullable.fromJson(Map<String, dynamic> json) =>
Expand Down Expand Up @@ -106,6 +110,8 @@ class GlobalConfigNullable with _$GlobalConfigNullable {
const String.fromEnvironment('CONVENIENT_TEST_GOLDEN_DIFF_GIT_REPO')),
runOnly: _emptyToNull(
const String.fromEnvironment('CONVENIENT_TEST_RUN_ONLY')),
reportSavePath: _emptyToNull(
const String.fromEnvironment('CONVENIENT_TEST_REPORT_SAVE_PATH')),
);
}

Expand All @@ -115,14 +121,16 @@ class GlobalConfigNullable with _$GlobalConfigNullable {
..addFlag('isolation-mode', defaultsTo: null)
..addFlag('enable-report-saver', defaultsTo: null)
..addOption('run-only', defaultsTo: null)
..addOption('golden-diff-git-repo', defaultsTo: null))
..addOption('golden-diff-git-repo', defaultsTo: null)
..addOption('report-save-path', defaultsTo: null))
.parse(args);

return GlobalConfigNullable(
isolationMode: results['isolation-mode'] as bool?,
enableReportSaver: results['enable-report-saver'] as bool?,
goldenDiffGitRepo: results['golden-diff-git-repo'] as String?,
runOnly: results['run-only'] as String?,
reportSavePath: results['report-save-path'] as String?,
);
}

Expand All @@ -143,13 +151,15 @@ extension ExtGlobalConfigNullable on GlobalConfigNullable {
enableReportSaver: other.enableReportSaver ?? enableReportSaver,
goldenDiffGitRepo: other.goldenDiffGitRepo ?? goldenDiffGitRepo,
runOnly: other.runOnly ?? runOnly,
reportSavePath: other.reportSavePath ?? reportSavePath,
);

GlobalConfig toConfig() => GlobalConfig(
isolationMode: isolationMode ?? false,
enableReportSaver: enableReportSaver ?? false,
goldenDiffGitRepo: goldenDiffGitRepo,
runOnly: runOnly,
reportSavePath: reportSavePath,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mixin _$GlobalConfigNullable {
bool? get enableReportSaver => throw _privateConstructorUsedError;
String? get goldenDiffGitRepo => throw _privateConstructorUsedError;
String? get runOnly => throw _privateConstructorUsedError;
String? get reportSavePath => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
Expand All @@ -41,7 +42,8 @@ abstract class $GlobalConfigNullableCopyWith<$Res> {
{bool? isolationMode,
bool? enableReportSaver,
String? goldenDiffGitRepo,
String? runOnly});
String? runOnly,
String? reportSavePath});
}

/// @nodoc
Expand All @@ -62,6 +64,7 @@ class _$GlobalConfigNullableCopyWithImpl<$Res,
Object? enableReportSaver = freezed,
Object? goldenDiffGitRepo = freezed,
Object? runOnly = freezed,
Object? reportSavePath = freezed,
}) {
return _then(_value.copyWith(
isolationMode: freezed == isolationMode
Expand All @@ -80,6 +83,10 @@ class _$GlobalConfigNullableCopyWithImpl<$Res,
? _value.runOnly
: runOnly // ignore: cast_nullable_to_non_nullable
as String?,
reportSavePath: freezed == reportSavePath
? _value.reportSavePath
: reportSavePath // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
Expand All @@ -96,7 +103,8 @@ abstract class _$$GlobalConfigNullableImplCopyWith<$Res>
{bool? isolationMode,
bool? enableReportSaver,
String? goldenDiffGitRepo,
String? runOnly});
String? runOnly,
String? reportSavePath});
}

/// @nodoc
Expand All @@ -114,6 +122,7 @@ class __$$GlobalConfigNullableImplCopyWithImpl<$Res>
Object? enableReportSaver = freezed,
Object? goldenDiffGitRepo = freezed,
Object? runOnly = freezed,
Object? reportSavePath = freezed,
}) {
return _then(_$GlobalConfigNullableImpl(
isolationMode: freezed == isolationMode
Expand All @@ -132,6 +141,10 @@ class __$$GlobalConfigNullableImplCopyWithImpl<$Res>
? _value.runOnly
: runOnly // ignore: cast_nullable_to_non_nullable
as String?,
reportSavePath: freezed == reportSavePath
? _value.reportSavePath
: reportSavePath // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
Expand All @@ -143,7 +156,8 @@ class _$GlobalConfigNullableImpl implements _GlobalConfigNullable {
{this.isolationMode,
this.enableReportSaver,
this.goldenDiffGitRepo,
this.runOnly});
this.runOnly,
this.reportSavePath});

factory _$GlobalConfigNullableImpl.fromJson(Map<String, dynamic> json) =>
_$$GlobalConfigNullableImplFromJson(json);
Expand All @@ -156,10 +170,12 @@ class _$GlobalConfigNullableImpl implements _GlobalConfigNullable {
final String? goldenDiffGitRepo;
@override
final String? runOnly;
@override
final String? reportSavePath;

@override
String toString() {
return 'GlobalConfigNullable(isolationMode: $isolationMode, enableReportSaver: $enableReportSaver, goldenDiffGitRepo: $goldenDiffGitRepo, runOnly: $runOnly)';
return 'GlobalConfigNullable(isolationMode: $isolationMode, enableReportSaver: $enableReportSaver, goldenDiffGitRepo: $goldenDiffGitRepo, runOnly: $runOnly, reportSavePath: $reportSavePath)';
}

@override
Expand All @@ -173,13 +189,15 @@ class _$GlobalConfigNullableImpl implements _GlobalConfigNullable {
other.enableReportSaver == enableReportSaver) &&
(identical(other.goldenDiffGitRepo, goldenDiffGitRepo) ||
other.goldenDiffGitRepo == goldenDiffGitRepo) &&
(identical(other.runOnly, runOnly) || other.runOnly == runOnly));
(identical(other.runOnly, runOnly) || other.runOnly == runOnly) &&
(identical(other.reportSavePath, reportSavePath) ||
other.reportSavePath == reportSavePath));
}

@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(runtimeType, isolationMode, enableReportSaver,
goldenDiffGitRepo, runOnly);
goldenDiffGitRepo, runOnly, reportSavePath);

@JsonKey(ignore: true)
@override
Expand All @@ -202,7 +220,8 @@ abstract class _GlobalConfigNullable implements GlobalConfigNullable {
{final bool? isolationMode,
final bool? enableReportSaver,
final String? goldenDiffGitRepo,
final String? runOnly}) = _$GlobalConfigNullableImpl;
final String? runOnly,
final String? reportSavePath}) = _$GlobalConfigNullableImpl;

factory _GlobalConfigNullable.fromJson(Map<String, dynamic> json) =
_$GlobalConfigNullableImpl.fromJson;
Expand All @@ -216,6 +235,8 @@ abstract class _GlobalConfigNullable implements GlobalConfigNullable {
@override
String? get runOnly;
@override
String? get reportSavePath;
@override
@JsonKey(ignore: true)
_$$GlobalConfigNullableImplCopyWith<_$GlobalConfigNullableImpl>
get copyWith => throw _privateConstructorUsedError;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:mobx/mobx.dart';
import 'package:test_api/src/backend/state.dart'; // ignore: implementation_imports

part 'worker_super_run_store.freezed.dart';

part 'worker_super_run_store.g.dart';

/// A "worker run" is the code execution from worker hot-restart to the next hot-restart
Expand Down Expand Up @@ -367,7 +366,7 @@ abstract class __WorkerSuperRunControllerIntegrationTestIsolationMode

// ITIM := IntegrationTestIsolationMode
@freezed
class _ITIMState with _$_ITIMState {
class _ITIMState with _$ITIMState {
/// Before first test finished
const factory _ITIMState.initial() = _ITIMStateInitial;

Expand Down
Loading