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

fix(uncovered-scenarios): tries to find related tests #18

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

nunomaduro
Copy link
Member

class User extends Authenticatable
{
    protected $hidden = [
        'password',
        'remember_token',
    ];

Due to how coverage works, mutations on properties like these will always be marked as uncovered, as they do not appear in the code coverage report, even if methods like ->getHidden() are tested.

This pull request aims to identify which tests might cover these properties by fetching all tests that include one or more covered lines in the same file.

Copy link
Collaborator

@gehrisandro gehrisandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nunomaduro

I am not sure if this is the right approach. This will work in some scenarios, but not in all.

For example, there will be cases where the code under mutation is hit by a test which does not hit any other lines in the same class.

What we should do instead is to check if the line under mutation is considered as executable in the coverage report. I think these lines can be found in the report under executableLinesIn.

If this is not the case, we should run all tests from files having covers() or mutates() for the mutated class and ignore the coverage report for this mutation, as it will always be empty.

I gave this already a try, but didn't find the time to finish yet. Looks like it requires a change on the covers() function itself, to make the list of test files, covering a class, accessible for the mutation plugin.

Tomorrow I am very busy, but I could give it a try on Tuesday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants