Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge coverage CI showing right percentage #759

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions tools/src/tester/TestResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,30 @@ export default class TestResults {
}

evaluated_operations(): Operation[] {
if (this._evaluated_operations !== undefined) return this._evaluated_operations
this._evaluated_operations = _.uniqWith(_.compact(_.flatMap(this._evaluations.evaluations, (evaluation) =>
_.map(evaluation.chapters, (chapter) => chapter.operation)
)), isEqual)
return this._evaluated_operations
if (this._evaluated_operations !== undefined) return this._evaluated_operations;

const all_operations = _.uniqWith(
_.compact(
_.flatMap(this._evaluations.evaluations, (evaluation) =>
_.map(evaluation.chapters, (chapter) => chapter.operation)
)
),
isEqual
);

// Filter operations to exclude paths or methods not in the spec or marked as 'x-ignorable'.
this._evaluated_operations = all_operations.filter((operation) => {
const spec_path = this._spec.spec().paths[operation.path];
if (!spec_path) return true;

const method_spec = (spec_path as Record<string, any>)[operation.method.toLowerCase()];
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (!method_spec) return true;

return method_spec['x-ignorable'] !== true;
});

return this._evaluated_operations;
}

unevaluated_operations(): Operation[] {
Expand Down Expand Up @@ -86,4 +105,4 @@ export default class TestResults {
write_coverage(file_path: string): void {
write_json(file_path, this.test_coverage())
}
}
}
Loading