plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.26k stars 44 forks source link

Code involving generics reported as uncovered #74

Open kevinbarabash opened 3 years ago

kevinbarabash commented 3 years ago

Version(if relevant): 2.14.5

Environment(if relevant):

  "typeCoverage": {
    "atLeast": 95,
    "detail": true,
    "ignoreCatch": true,
    "project": "tsconfig-coverage.json",
    "strict": true
  }

Code(if relevant):

const map = new Map<number, number>();
for (const [k, v] of map.entries()) {
    console.log(`k = ${k}, v = ${v}`);
}

Expected:

%100 coverage.

Actual:

test-case.ts:2:13: k
test-case.ts:2:16: v
test-case.ts:3:24: k
test-case.ts:3:34: v
plantain-00 commented 3 years ago

What's your tsconfig-coverage.json, My local test case is good for just:

{
    "files": [
        "test-case.ts"
    ]
}
kevinbarabash commented 3 years ago

The repo that I'm experiencing this in is using project references. There are other issues with types being shared between sub-projects not being recognized. I'll try to put together a smaller example repo that exhibits these issues.