Skip to content
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
8 changes: 1 addition & 7 deletions .github/workflows/very_good_test_runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ on:

jobs:
build:
strategy:
matrix:
flutter_version:
- "3.24.0" # The Flutter version with a Dart SDK that matches the minimum Dart SDK version supported by the package.
- "3.x" # The Flutter version with a Dart SDK that matches the maximum Dart SDK version supported by the package.

uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
flutter_version: ${{ matrix.flutter_version }}
flutter_version: "3.35.x"
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.yaml
1 change: 1 addition & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ targets:
- cast_nullable_to_non_nullable
- require_trailing_commas
- lines_longer_than_80_chars
- specify_nonobvious_property_types
json_serializable:
options:
create_to_json: false
Expand Down
1 change: 1 addition & 0 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This is not production code.
// ignore_for_file: avoid_print

import 'package:very_good_test_runner/very_good_test_runner.dart';
Expand Down
44 changes: 16 additions & 28 deletions lib/src/models/test_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,20 @@ abstract class TestEvent {
/// Converts [json] into a [TestEvent].
static TestEvent fromJson(Map<String, dynamic> json) {
final type = json['type'] as String?;
switch (type) {
case 'start':
return StartTestEvent.fromJson(json);
case 'allSuites':
return AllSuitesTestEvent.fromJson(json);
case 'suite':
return SuiteTestEvent.fromJson(json);
case 'debug':
return DebugTestEvent.fromJson(json);
case 'group':
return GroupTestEvent.fromJson(json);
case 'testStart':
return TestStartEvent.fromJson(json);
case 'print':
return MessageTestEvent.fromJson(json);
case 'error':
return ErrorTestEvent.fromJson(json);
case 'testDone':
return TestDoneEvent.fromJson(json);
case 'done':
return DoneTestEvent.fromJson(json);
case 'exit':
return ExitTestEvent.fromJson(json);
default:
throw UnsupportedError('Unsupported type: $type');
}
return switch (type) {
'start' => StartTestEvent.fromJson(json),
'allSuites' => AllSuitesTestEvent.fromJson(json),
'suite' => SuiteTestEvent.fromJson(json),
'debug' => DebugTestEvent.fromJson(json),
'group' => GroupTestEvent.fromJson(json),
'testStart' => TestStartEvent.fromJson(json),
'print' => MessageTestEvent.fromJson(json),
'error' => ErrorTestEvent.fromJson(json),
'testDone' => TestDoneEvent.fromJson(json),
'done' => DoneTestEvent.fromJson(json),
'exit' => ExitTestEvent.fromJson(json),
_ => throw UnsupportedError('Unsupported type: $type'),
};
}

/// The type of the event.
Expand Down Expand Up @@ -275,7 +263,7 @@ enum TestResult {
failure,

/// the test had an error other than `TestFailure`
error
error,
}

/// {@template test_done_event}
Expand Down Expand Up @@ -341,7 +329,7 @@ class DoneTestEvent extends TestEvent {
class ExitTestEvent extends TestEvent {
/// {@macro test_exit_event}
const ExitTestEvent({required super.time, required this.exitCode})
: super(type: 'exit');
: super(type: 'exit');

/// {@macro test_exit_event}
factory ExitTestEvent.fromJson(Map<String, dynamic> json) =>
Expand Down
Loading