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

missing coverage of closing brace in switch/case when const is declared #497

Open
tbiesemann opened this issue Oct 30, 2023 · 1 comment

Comments

@tbiesemann
Copy link

tbiesemann commented Oct 30, 2023

  • Node Version:18.14.0
  • c8 Version:8.0.1
  • Platform:Darwin C02C26P7MD6T 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_64
function huhu(someValue) {
	switch (someValue) {
		case true:
			const result = 42;
			return result;
		default:
			return 43;
	}
};
huhu(true);
huhu(false);

Execute with

npx c8 node huhu.js

Reported coverage:
image

If i omit the const declaration and just return 42; the coverage is 100%.
Expectation is to have 100% coverage for the above snippet.

@ericmorand
Copy link

I have the exact same issue covering this function:

https://gitlab.com/eric.morand/twing/-/blob/one-hundred/src/lib/parser.ts?ref_type=heads#L348

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

No branches or pull requests

2 participants