diff --git a/packages/nextcloud/pubspec.yaml b/packages/nextcloud/pubspec.yaml index 3c5054e2..16958c77 100644 --- a/packages/nextcloud/pubspec.yaml +++ b/packages/nextcloud/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: dev_dependencies: build_runner: ^2.2.1 - # coverage: ^1.3.2 + coverage: ^1.6.1 dynamite: path: ../dynamite json_serializable: ^6.3.2 diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index 7eab9ff8..7172259d 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -291,7 +291,7 @@ class TestDockerHelper { int randomPort() => 1024 + Random().nextInt(65535 - 1024); void expectDateInReasonableTimeRange(final DateTime actual, final DateTime expected) { - const duration = Duration(seconds: 5); + const duration = Duration(seconds: 10); expect(actual.isAfter(expected.subtract(duration)), isTrue); expect(actual.isBefore(expected.add(duration)), isTrue); } diff --git a/tool/coverage.sh b/tool/coverage.sh new file mode 100755 index 00000000..77655576 --- /dev/null +++ b/tool/coverage.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -euxo pipefail +cd "$(dirname "$0")/.." + +rm -rf /tmp/nextcloud-neon +mkdir -p /tmp/nextcloud-neon + +( + cd packages/nextcloud + rm coverage -rf + fvm dart run coverage:test_with_coverage --function-coverage --branch-coverage -- --timeout 60s "$@" + lcov --remove coverage/lcov.info "$(pwd)/lib/src/nextcloud.openapi.g.dart" -o coverage/filtered.info + genhtml coverage/filtered.info -o coverage/html +) diff --git a/tool/test.sh b/tool/test.sh deleted file mode 100755 index 4980e4de..00000000 --- a/tool/test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -euxo pipefail -cd "$(dirname "$0")/.." - -rm -rf /tmp/nextcloud-neon -mkdir -p /tmp/nextcloud-neon - -( - cd packages/nextcloud - fvm dart test "$@" - - # The coverage used to work, but due to some change it's broken right now - #rm coverage -rf - #fvm dart run coverage:test_with_coverage --function-coverage --branch-coverage "$@" - #lcov --remove coverage/lcov.info "$(pwd)/lib/src/clients/**/model/*" "$(pwd)/lib/src/clients/**/auth/*" "$(pwd)/lib/src/clients/common/*" "$(pwd)/lib/src/clients/**/api_client.dart" -o coverage/filtered.info - #genhtml coverage/filtered.info -o coverage/html -)