Browse Source

tool: Fix coverage script, it works now

pull/24/head
jld3103 2 years ago
parent
commit
54e6c1ed1f
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/nextcloud/pubspec.yaml
  2. 2
      packages/nextcloud/test/helper.dart
  3. 14
      tool/coverage.sh
  4. 17
      tool/test.sh

2
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

2
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);
}

14
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
)

17
tool/test.sh

@ -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
)
Loading…
Cancel
Save