Skip to content

Commit

Permalink
[SuperEditor][SuperTextLayout] Move golden runner to new package and …
Browse files Browse the repository at this point in the history
…fix local golden failures (Resolves #1265) (#1267)
  • Loading branch information
angelosilvestre authored Aug 3, 2023
1 parent 7c7ad2c commit 0b5e7c3
Show file tree
Hide file tree
Showing 34 changed files with 917 additions and 545 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*/example/
*/build/
*/.dart_tool/

# We dont need git history inside the image.
.git

# Ignore the golden failure directories because they will be mapped.
**/failures/
30 changes: 30 additions & 0 deletions golden_runner/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
10 changes: 10 additions & 0 deletions golden_runner/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "f8afcd5aa01b3ae6c55cb6e4c9fa4171e27a92f6"
channel: "master"

project_type: package
3 changes: 3 additions & 0 deletions golden_runner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions golden_runner/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
41 changes: 41 additions & 0 deletions golden_runner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
This package contains a tool to run golden tests and update golden files in a docker container.

The command should be run from the root of the package being tested.

## Activate the package:

```console
dart pub global activate --source path ./golden_runner
```

## Run golden tests:

```
# run all tests
flutter pub run ../golden_runner/tool/goldens test
# run a single test
flutter pub run ../golden_runner/tool/goldens test --plain-name "something"
# run all tests in a directory
flutter pub run ../golden_runner/tool/goldens test test_goldens/my_dir
# run a single test in a directory
flutter pub run ../golden_runner/tool/goldens test --plain-name "something" test_goldens/my_dir
```

## Update golden files:

```
# update all goldens
flutter pub run ../golden_runner/tool/goldens update
# update all goldens in a directory
flutter pub run ../golden_runner/tool/goldens update test_goldens/my_dir
# update a single golden
flutter pub run ../golden_runner/tool/goldens update --plain-name "something"
# update a single golden in a directory
flutter pub run ../golden_runner/tool/goldens update --plain-name "something" test_goldens/my_dir
```
4 changes: 4 additions & 0 deletions golden_runner/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
17 changes: 17 additions & 0 deletions golden_runner/bin/goldens.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'dart:io';

// ignore: depend_on_referenced_packages
import 'package:args/command_runner.dart';
import 'package:golden_runner/golden_runner.dart';

Future<void> main(List<String> arguments) async {
final runner = CommandRunner("goldens", "A tool to run and update golden tests using docker")
..addCommand(GoldenTestCommand())
..addCommand(UpdateGoldensCommand());

try {
await runner.run(arguments);
} on UsageException catch (e) {
stdout.write(e);
}
}
3 changes: 3 additions & 0 deletions golden_runner/lib/golden_runner.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library golden_runner;

export 'src/commands.dart';
Loading

0 comments on commit 0b5e7c3

Please sign in to comment.