-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat(metrics): add aggregateResultsByModule
function
#1225
Conversation
Add `aggregateResultsByModule`, which can be used merge multiple reports into 1. Closes #1180
aggregateResultsByModule
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments about the code. But we've also talked about adding another possible field in the schema to allow multiple full reports aggregated inside a single schema (with different thresholds, configs, etc). How does that relate to this? I wouldn't want to merge this and expose it as a public API if we're going to make a very similar functionality soon as well
config: {}, | ||
projectRoot: undefined, | ||
}; | ||
expect(aggregateResultsByModule(Object.create(null))).deep.eq(expectedReport); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if an empty object is passed to the function? This Object.create
thing makes me worry it gives unexpected results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.create(null)
is the emptiest object there is. Even more empty than {}
, since it won't even have Object.prototype
as its prototype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does {}
give a different result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then that should probably also have a test, right? {}
seems a lot more common 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Added the test
I still want that, but I don't want to spend the time for that a.t.m. I actually just want the merging of tests files in the dashboard, and wanted to move that out of the dashboard because users are asking for it as well.
When that functionality lands, I would expect the internals of this function to change so it provides the new format. |
@nicojs What is the current status of this PR? |
I forgot about it 😶 |
Ship it! |
aggregateResultsByModule
[(Record<string, MutationTestResult>) => MutationTestResult
]Aggregates multiple reports together into a single report, grouped by module.
Input:
resultsByModule
The MutationTestResult objects by module name.Closes #1180