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 analysis modifies a function return #856

Closed
danielo515 opened this issue Aug 31, 2018 · 0 comments
Closed

coverage analysis modifies a function return #856

danielo515 opened this issue Aug 31, 2018 · 0 comments
Assignees
Labels
bug
Milestone

Comments

@danielo515
Copy link

@danielo515 danielo515 commented Aug 31, 2018

Hello,
This issue affects both lab14 and lab16 (didn't tried 15).

The problems is that code analysis is, in some way modifying the returning value of a function. It is a very simple function like this:

const trace = (msg) => (x) => (console.info(msg, x), x);

When I run the test without code coverage it works as expected. When I run the test with code coverage activated then the return value of the function is undefined.
I'm using this function on a promise chain and the following function in the chain is destructuring the result value of the previous function and of course it is failing because it can not destructure undefined.

Here is a fully working GIST that you can use as playground:

https://gist.github.com/danielo515/22e33e3a4d48c0b60a4da16008cedd39

There is a branch called lab16 where you can test with lab 16

I'm very sure that the problem is code coverage of this function because if wrap the function between coverage on and off then everything works as expected and test passes:

// This is a simple but valid function
/* $lab:coverage:off$ */
const trace = (msg) => (x) => (console.info(msg, x), x);
/* $lab:coverage:on$ */

Thanks and regards

@geek geek added the bug label Nov 10, 2018
@hueniverse hueniverse self-assigned this Sep 22, 2019
@hueniverse hueniverse added this to the 20.2.3 milestone Sep 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.