Async jest function not receiving 100% branch coverage

Viewed 587

I have this function:

async testTheTest () {
  return 'tested'
}  

And this test:

it('test this', async () => {
  await expect(wrapper.vm.testTheTest()).resolves.toBe('tested')
})

When I run this test my code coverage is 100%, but my branch coverage isn't. I think that this has to do with the return value supposedly not being tested, but am unsure why. If I change the function to be:

testTheTest () {
  return 'tested'
}  

The branch coverage suddenly is 100%. It isn't an issue for this specific function since it doesn't contain any async code, but the issue appears in other functions as well.

Languages used: Vue, Jest and Istanbul Jest is updated to the latest version, but the issue seems to appear in older versions as well.

0 Answers
Related