-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@ F widget tests, formatted code, some minor changes
- Loading branch information
1 parent
30c1e1a
commit 1c8219d
Showing
21 changed files
with
350 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ generated_* | |
|
||
# Other files | ||
.old.dart | ||
.build | ||
build/ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
part of '../../approval_tests.dart'; | ||
|
||
/// `GitReporter` is a class for reporting the comparison results using the git. | ||
class GitReporter implements Reporter { | ||
const GitReporter(); | ||
|
||
@override | ||
Future<void> report(String approvedPath, String receivedPath) async { | ||
const DiffInfo diffInfo = | ||
DiffInfo(name: "Git", command: 'git', arg: 'diff --no-index'); | ||
|
||
try { | ||
await Future.wait([ | ||
_checkFileExists(approvedPath), | ||
_checkFileExists(receivedPath), | ||
]); | ||
|
||
await Process.run( | ||
diffInfo.command, | ||
[diffInfo.arg, approvedPath, receivedPath], | ||
); | ||
} catch (e, st) { | ||
if (e is PathNotFoundException) { | ||
ApprovalLogger.exception(e, stackTrace: st); | ||
rethrow; | ||
} | ||
if (e is ProcessException) { | ||
final ProcessResult result = | ||
await Process.run(ApprovalUtils.commandWhere, [diffInfo.command]); | ||
ApprovalLogger.exception( | ||
'Error during comparison via Git. Please make sure that Git is installed and available in the system path. Error: ${e.message}. Git path: ${result.stdout}', | ||
stackTrace: st, | ||
); | ||
} | ||
rethrow; | ||
} | ||
} | ||
|
||
Future<void> _checkFileExists(String path) async { | ||
if (!ApprovalUtils.isFileExists(path)) { | ||
throw PathNotFoundException( | ||
path, | ||
const OSError('File not found'), | ||
'From GitReporter: File not found at path: [$path]. Please check the path and try again.', | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.