https://github.com/defuncart/dart_test_utils
A dart tool containing test utils.
https://github.com/defuncart/dart_test_utils
dart dart-tests flutter flutter-testing tool
Last synced: about 2 months ago
JSON representation
A dart tool containing test utils.
- Host: GitHub
- URL: https://github.com/defuncart/dart_test_utils
- Owner: defuncart
- License: mit
- Created: 2023-11-23T12:09:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-27T12:48:22.000Z (about 1 year ago)
- Last Synced: 2025-02-16T04:28:51.345Z (4 months ago)
- Topics: dart, dart-tests, flutter, flutter-testing, tool
- Language: Dart
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dart_test_utils
A dart tool containing test utils.
## Installation
The tool can be installed by activating the package on your local machine: `dart pub global activate dart_test_utils`. Similarly, the tool can be uninstalled via `dart pub global deactivate dart_test_utils`. Alternatively, the tool can be a depended upon in a dart/flutter project:
```yaml
dev_dependencies:
dart_test_utils:
```## Organize Test Folder
This tools re-organizes the file structure of `/test` to match `lib`.
For instance, if the file structure was
```
lib/
├─ features/
│ ├─ feature_1/
│ │ ├─ feature_1_repository.dart
test/
├─ feature_1_repository_test.dart
```then
`test/feature_1_repository_test.dart` would be moved into `test/features/feature_1/feature_1_repository_test.dart`.
### Usage
```sh
dart pub global run dart_test_utils:organize_test_folder --apply
```or
```sh
dart run dart_test_utils:organize_test_folder --apply
```if the tool is a dev dependency.
The option `--set-exit-if-changed` can be used in a CI pipeline to fail when there are file changes. For a full overview, see `dart run dart_test_utils:organize_test_folder -h`.
### Expected Behavior
- When a file should be moved, if a file exists at the target location, then the existing file will be overwritten.
- If a moved file contains relative paths (i.e. `import '../mocks.dart'`), then the path will need manual resolution.