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

Coverage being analized on the test file #853

Closed
danielo515 opened this issue Aug 27, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@danielo515
Copy link

@danielo515 danielo515 commented Aug 27, 2018

Hello,

I am getting problems with coverage analysis. I am using .spec.js files close to my files being tested. This is very convenient and lab was easy to configure for this setup. However today I have added a new file and lab is reporting that some lines at that file are missing coverage.
This is weird not only because (IMO) test files should not be tested for coverage, but the reported lines are actually being executed, so I'm a bit puzzled here.

Here is the header of the file, it includes the lines that are being reported as uncovered:

describe ('== CSV-paginator', () =>
{
    const fields = { page: 'page', pageSize:'pageSize', total: 'total' };
    describe ('=== Input validation', () =>
    {
        it ('Should throw when fields argument is incorrect', _ =>
            expect ( () => paginate ({})).to.throw (Error, /not a member of ‘\{ page/i) );
        it ('Should throw when second argument is missing',   _ =>
            expect (paginate (fields)).to.throw (Error, /applied to the wrong number of arguments/i));
        it ('Should throw when pageSize argument is not a number',   _ =>
            expect (() => paginate (fields) (i => i) ('blah')).to.throw (Error, /The value at position . is not a member of ‘Integer’/i));
        it ('Should throw when command argument is not an object',   _ =>
            expect (() => paginate (fields) (i => i) (10) ('blah')).to.throw (Error, /The value at position . is not a member of ‘Object’/i));
    });

This is how I execute lab:

    "test": "lab --assert code --coverage --pattern spec --default-plan-threshold 1 -t 80 -v src",

I tried excluding the file without luck

    "test": "lab --assert code --coverage --pattern spec --default-plan-threshold 1 --coverage-exclude paginator.spec.js -t 80 -v src",

I'm using

code@5.2.0
lab@15.5.0

Thanks in advance
Regards

@danielo515

This comment has been minimized.

Copy link
Author

@danielo515 danielo515 commented Aug 27, 2018

I just generated a coverage report, and here are the lines that are not being covered

captura de pantalla 2018-08-27 a las 17 16 23

As I said, those lines are being executed because the assertion count is correct

  === Input validation
    ✔ 1) Should throw when fields argument is incorrect (44 ms and 1 assertions)
    ✔ 2) Should throw when second argument is missing (13 ms and 1 assertions)
    ✔ 3) Should throw when pageSize argument is not a number (13 ms and 1 assertions)
    ✔ 4) Should throw when command argument is not an object (24 ms and 1 assertions)

I just noticed that the other spec files are also being included, but they have 100% code coverage.
Can this be an issue on lab trying to cover lines that are modified by itself ?

@geek geek added this to the 17.3.0 milestone Nov 4, 2018
@geek geek self-assigned this Nov 4, 2018
@geek geek added the feature label Nov 4, 2018
@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Nov 4, 2018

Fixed by #881

@geek geek closed this Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.