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

Functions in conditionals are not included in the coverage report #233

Closed
hheimerd opened this issue Apr 17, 2024 · 1 comment · Fixed by #237
Closed

Functions in conditionals are not included in the coverage report #233

hheimerd opened this issue Apr 17, 2024 · 1 comment · Fixed by #237

Comments

@hheimerd
Copy link

hheimerd commented Apr 17, 2024

This is a minimal case for reproduction

let i = 0;

const t = true && {
    renderFn: () => (
        i++
    ),
}

t.renderFn();

babel result:

...
var i = (cov_1a1nkg2pc4().s[0]++, 0);
var t = (cov_1a1nkg2pc4().s[1]++, (cov_1a1nkg2pc4().b[0][0]++, true) && (cov_1a1nkg2pc4().b[0][1]++, {
    renderFn: function renderFn() {
        cov_1a1nkg2pc4().f[0]++;           <<< HERE
        cov_1a1nkg2pc4().s[2]++;
        return i++;
    }
}));
cov_1a1nkg2pc4().s[3]++;
t.renderFn();
...

this plugin result:

...
cov_1387234055988355335();
cov_1387234055988355335().s[1]++;
var t = (cov_1387234055988355335().b[0][0]++, true) && (cov_1387234055988355335().b[0][1]++, {
    renderFn: function() {
        return i++;                         <<< HERE
    }
});
cov_1387234055988355335().s[2]++;
t.renderFn();
...
@hheimerd hheimerd changed the title Functions in conditionals is not included in coverage report Functions in conditionals are not included in the coverage report Apr 17, 2024
@kwonoj
Copy link
Owner

kwonoj commented Apr 17, 2024

Similar to #224 (comment), I guess there's some missing coverage. Happy to accept PR.

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 a pull request may close this issue.

2 participants