setup function

Future<void> setup({
  1. List<String>? args,
  2. bool headlessMode = false,
  3. bool registerMiscDartService = true,
  4. bool registerFsService = true,
  5. bool registerHighlightStoreBase = true,
  6. bool registerVideoPlayerStoreBase = true,
  7. bool registerVmServiceWrapper = true,
  8. bool parseConfigFile = true,
})

Implementation

Future<void> setup({
  List<String>? args,
  bool headlessMode = false,
  bool registerMiscDartService = true,
  bool registerFsService = true,
  bool registerHighlightStoreBase = true,
  bool registerVideoPlayerStoreBase = true,
  bool registerVmServiceWrapper = true,
  // widget tests cannot handle async io, so
  // you might want to disable config parsing
  bool parseConfigFile = true,
}) async {
  GlobalConfigStore.config = parseConfigFile
      ? await GlobalConfigNullable.parse(args: args, headlessMode: headlessMode)
      : GlobalConfigNullable().toConfig();

  getIt.registerSingleton<LogStore>(LogStore());
  getIt.registerSingleton<SuiteInfoStore>(SuiteInfoStore());
  getIt.registerSingleton<RawLogStore>(RawLogStore());
  getIt.registerSingleton<WorkerSuperRunStore>(WorkerSuperRunStore());
  getIt.registerSingleton<VideoRecorderStore>(VideoRecorderStore());
  getIt.registerSingleton<ConvenientTestManagerService>(ConvenientTestManagerService());

  getIt.registerSingleton<ReportHandlerService>(ReportHandlerService());
  getIt.registerSingleton<ManagerReportSaverService>(ManagerReportSaverService());
  getIt.registerSingleton<ScreenVideoRecorderService>(ScreenVideoRecorderService.create());

  if (registerMiscDartService) getIt.registerSingleton<MiscDartService>(MiscDartService());
  if (registerFsService) getIt.registerSingleton<FsService>(FsServiceDart());
  if (registerHighlightStoreBase) getIt.registerSingleton<HighlightStoreBase>(HighlightStoreDummy());
  if (registerVideoPlayerStoreBase) getIt.registerSingleton<VideoPlayerStoreBase>(VideoPlayerStoreDummy());
  if (registerVmServiceWrapper) getIt.registerSingleton<VmServiceWrapperService>(RealVmServiceWrapperService());

  GetIt.I.get<ConvenientTestManagerService>().serve();

  Log.i('setup', 'GlobalConfig: ${GlobalConfigStore.config}');
}