Skip to content

Commit

Permalink
refactor: update coverage output paths to use 'var/coverage_data' dir…
Browse files Browse the repository at this point in the history
…ectory
  • Loading branch information
Dhruv-Maradiya committed Feb 2, 2025
1 parent 6c85d14 commit fc28600
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions pkgs/coverage/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ build
# Temp files
*~
coverage/
var/
test/test_coverage_options/coverage_data
var/
24 changes: 12 additions & 12 deletions pkgs/coverage/test/collect_coverage_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void main() {
expect(
path.canonicalize(collectedCoverage.out!),
path.canonicalize(
'test/test_coverage_options/coverage_data/coverage.json'));
'var/coverage_data/coverage.json'));

// Verify format coverage yaml values
expect(
path.canonicalize(formattedCoverage.output!),
path.canonicalize(
'test/test_coverage_options/coverage_data/lcov.info'));
'var/coverage_data/lcov.info'));
expect(path.canonicalize(formattedCoverage.packagePath),
path.canonicalize('test/test_files'));

Expand All @@ -79,7 +79,7 @@ void main() {
path.canonicalize('test/test_files'));
expect(testCoverage.packageName, 'My Dart Package');
expect(path.canonicalize(testCoverage.outDir),
path.canonicalize('test/test_coverage_options/coverage_data'));
path.canonicalize('var/coverage_data'));
expect(testCoverage.testScript, 'test1');
expect(testCoverage.functionCoverage, isTrue);
expect(testCoverage.branchCoverage, isFalse);
Expand All @@ -103,13 +103,13 @@ void main() {
expect(
path.canonicalize(collectedCoverage.out!),
path.canonicalize(
'test/test_coverage_options/coverage_data/custom_coverage/coverage.json'));
'var/coverage_data/custom_coverage/coverage.json'));
expect(collectedCoverage.scopedOutput, ['lib', 'test']);
expect(collectedCoverage.functionCoverage, isFalse);
expect(
path.canonicalize(formattedCoverage.output!),
path.canonicalize(
'test/test_coverage_options/coverage_data/custom_coverage/lcov.info'));
'var/coverage_data/custom_coverage/lcov.info'));
expect(testCoverage.packageName, 'Custom Dart Package');
expect(testCoverage.scopeOutput, ['lib', 'test']);
});
Expand All @@ -134,13 +134,13 @@ void main() {
expect(
path.canonicalize(collectedCoverage.out!),
path.canonicalize(
'test/test_coverage_options/coverage_data/custom_lcov/coverage.json'));
'var/coverage_data/custom_lcov/coverage.json'));

// Verify format coverage yaml values
expect(
path.canonicalize(formattedCoverage.output!),
path.canonicalize(
'test/test_coverage_options/coverage_data/custom_lcov/lcov.info'));
'var/coverage_data/custom_lcov/lcov.info'));
expect(path.canonicalize(formattedCoverage.packagePath),
path.canonicalize('test/test_coverage_options'));

Expand All @@ -149,7 +149,7 @@ void main() {
expect(
path.canonicalize(testCoverage.outDir),
path.canonicalize(
'test/test_coverage_options/coverage_data/custom_lcov'));
'var/coverage_data/custom_lcov'));
expect(testCoverage.testScript, 'custom_test');
expect(testCoverage.functionCoverage, isTrue);
});
Expand All @@ -163,13 +163,13 @@ void main() {

// Parse arguments with command line args
final collectedCoverage = collect_coverage.parseArgs([
'--out=/test/test_coverage_options/coverage_data/coverage.json',
'--out=/var/coverage_data/coverage.json',
'--scope-output=lib',
'--no-function-coverage',
'--branch-coverage',
], configuredOptions);
final formattedCoverage = format_coverage.parseArgs([
'--out=/test/test_coverage_options/coverage_data/out_test.info',
'--out=/var/coverage_data/out_test.info',
'--package=../code_builder',
], configuredOptions);
final testCoverage = await test_with_coverage.parseArgs([
Expand All @@ -183,7 +183,7 @@ void main() {
expect(
collectedCoverage.out,
path.normalize(
'/test/test_coverage_options/coverage_data/coverage.json'));
'/var/coverage_data/coverage.json'));
expect(collectedCoverage.scopedOutput, ['lib']);
expect(collectedCoverage.functionCoverage, isFalse);
expect(collectedCoverage.branchCoverage, isTrue);
Expand All @@ -192,7 +192,7 @@ void main() {
expect(
formattedCoverage.output,
path.normalize(
'/test/test_coverage_options/coverage_data/out_test.info'));
'/var/coverage_data/out_test.info'));
expect(formattedCoverage.packagePath, '../code_builder');

// Verify test with coverage command line args
Expand Down
2 changes: 1 addition & 1 deletion pkgs/coverage/test/test_coverage_options/all_field.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output-directory: "coverage_data"
output-directory: "../../var/coverage_data"
scope-output: ["lib", "src"]
function-coverage: true
branch-coverage: false
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output-directory: 'coverage_data/custom_coverage'
output-directory: '../../var/coverage_data/custom_coverage'
scope-output:
- 'lib'
- 'test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ scope-output:
- 'lib'
- 'tools'
branch-coverage: false
output-directory: 'coverage_data/custom_lcov'
output-directory: '../../var/coverage_data/custom_lcov'
package-directory: '.'
test_script: 'custom_test'
function-coverage: true

0 comments on commit fc28600

Please sign in to comment.