Skip to content

Commit

Permalink
Update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Dec 4, 2024
1 parent 2e5fc8f commit 31e1231
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
27 changes: 9 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,36 @@ format: ## Format the code

.PHONY: get
get: ## Get the dependencies
@dart pub get
@flutter pub get

.PHONY: outdated
outdated: get ## Check for outdated dependencies
@dart pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases
@flutter pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases

.PHONY: test
test: get ## Run the tests
@dart test --debug --coverage=coverage --platform vm,chrome test/unit_test.dart
@flutter test --concurrency=40 test/unit_test.dart test/widget_test.dart

.PHONY: publish-check
publish-check: ## Check the package before publishing
@dart pub publish --dry-run
@flutter pub publish --dry-run

.PHONY: deploy-check
deploy-check: publish-check

.PHONY: publish
publish: ## Publish the package
@yes | dart pub publish
@yes | flutter pub publish

.PHONY: deploy
deploy: publish

.PHONY: coverage
coverage: get ## Generate the coverage report
# @dart pub global activate coverage
# @dart pub global run coverage:test_with_coverage -fb -o coverage -- \
# --platform vm --compiler=kernel --coverage=coverage \
# --reporter=expanded --file-reporter=json:coverage/tests.json \
# --timeout=10m --concurrency=12 --color \
# test/unit_test.dart test/widget_test.dart
# @dart test --concurrency=6 --platform vm --coverage=coverage test/
# @dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --report-on=lib
# @mv coverage/lcov.info coverage/lcov.base.info
# @lcov -r coverage/lcov.base.info -o coverage/lcov.base.info "lib/src/protobuf/client.*.dart" "lib/**/*.g.dart"
# @mv coverage/lcov.base.info coverage/lcov.info
# @lcov --list coverage/lcov.info
# @genhtml -o coverage coverage/lcov.info
@flutter test --coverage --concurrency=40 test/unit_test.dart test/widget_test.dart
@lcov --remove coverage/lcov.info 'lib/**/*.g.dart' -o coverage/lcov.info
@lcov --list coverage/lcov.info
@genhtml -o coverage coverage/lcov.info

.PHONY: analyze
analyze: get ## Analyze the code
Expand Down
21 changes: 18 additions & 3 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ void main() {
testWidgets(
'Pump RePaint',
(tester) async {
final widget = RePaint(painter: RePainterFake());
final painter = RePainterFake();
final widget = RePaint(painter: painter);
await tester.pumpWidget(widget);
expect(find.byWidget(widget), allOf(isNotNull, findsOneWidget));
expect(
Expand Down Expand Up @@ -40,13 +41,27 @@ void main() {
),
),
);
final box = context.renderObject as RePaintBox;
await tester.pumpWidget(RePaint(painter: painter));
expect(find.byType(RePaint), findsOneWidget);
final box =
find.byType(RePaint).evaluate().single.renderObject as RePaintBox;
expect(
box,
allOf(
isNotNull,
isA<RenderObject>(),
isA<RePaintBox>()
.having(
(r) => r.context.widget,
'painter',
allOf(
isNotNull,
isA<Widget>(),
isA<LeafRenderObjectWidget>(),
isA<RePaint>(),
isNot(same(widget)),
),
)
.having(
(r) => r.painter,
'painter',
Expand All @@ -55,7 +70,7 @@ void main() {
isA<IRePainter>(),
isA<RePainterBase>(),
isA<RePainterFake>(),
same(widget.painter),
same(painter),
),
)
.having(
Expand Down

0 comments on commit 31e1231

Please sign in to comment.