wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
759 stars 45 forks source link

Orange test coverage icon is not showing up for an ES6 arrow function shorthand return in a JS file #1846

Closed MechJosh0 closed 6 years ago

MechJosh0 commented 6 years ago

Issue description

Below is Wallaby showing what is being tested: \src\packages\core\index.ts image

\src\pink.js image

\src\pink.js is showing green for calc2 because it's being executed (exported), but calc3 is showing as grey inside the function because it knows the function isn't being tested.

\src\packages\core\index.ts is the same as above, but calc2 is orange because it can see the line is being executed but the ES6 function isn't being tested.

What should happen

Both \src\packages\core\index.ts and \src\pink.js are being tested in the same way. I would expect the colours to be the same.

Wallaby.js configuration file

https://github.com/MechJosh0/nuls-js/blob/master/wallaby.js

Code editor or IDE name and version

PhpStorm: 2018.2.4

OS name and version

Windows 10

ArtemGovorov commented 6 years ago

Thanks for the report. The issue is fixed and the fix is published in the latest Wallaby core version.

Note that there's only one issue that we have fixed (orange icon should appear for calc2), other things are working as expected:

  • \src\pink.js:calc2 should be orange

Fixed.

  • \src\pink.js:foo should be greeen

This is working as expected because export statements are not highlighted for coverage purposes (similar to some other code constructs such as class definitions, etc.).

The same statement is not highlighted in TypeScript either.

Note that statements like export const calc = ... are highlighted because there is a variable (constant) declaration in those lines/statements.

  • \src\packages\core\index.ts:moduleDescription should be orange

This is working as expected because the executed statement on the line is const moduleDescription = '...'. The fact that the constant is not used doesn't change the code coverage.

Hope it makes sense. Please let us know if you have any questions regarding how Wallaby coverage works, we are happy to answer.

MechJosh0 commented 6 years ago

Thanks for the fix and information on the other concerns.