@@ -19,7 +19,8 @@ test('in-source tests work', async () => {
1919 ]
2020 ` )
2121
22- const fileCoverage = coverageMap . fileCoverageFor ( '<process-cwd>/fixtures/src/in-source.ts' )
22+ const fileCoverage = coverageMap . fileCoverageFor ( files [ 0 ] )
23+ const functions = Object . values ( fileCoverage . fnMap ) . map ( fn => fn . name )
2324
2425 // If-branch is not taken - makes sure source maps are correct in in-source testing too
2526 expect ( fileCoverage . getUncoveredLines ( ) ) . toContain ( '5' )
@@ -28,7 +29,7 @@ test('in-source tests work', async () => {
2829 expect ( fileCoverage ) . toMatchInlineSnapshot ( `
2930 {
3031 "branches": "2/4 (50%)",
31- "functions": "1/1 (100%)",
32+ "functions": "2/2 (100%)",
3233 "lines": "10/12 (83.33%)",
3334 "statements": "10/12 (83.33%)",
3435 }
@@ -37,11 +38,23 @@ test('in-source tests work', async () => {
3738 else {
3839 expect ( fileCoverage ) . toMatchInlineSnapshot ( `
3940 {
40- "branches": "3/6 (50%)",
41- "functions": "2/2 (100%)",
42- "lines": "6/7 (85.71 %)",
43- "statements": "6/7 (85.71 %)",
41+ "branches": "2/4 (50%)",
42+ "functions": "1/1 (100%)",
43+ "lines": "2/3 (66.66 %)",
44+ "statements": "2/3 (66.66 %)",
4445 }
4546 ` )
4647 }
48+
49+ // v8-to-istanbul cannot exclude whole if-block
50+ if ( isV8Provider ( ) ) {
51+ return
52+ }
53+
54+ // The "customNamedTestFunction" should be excluded by auto-generated ignore hints
55+ expect ( functions ) . toMatchInlineSnapshot ( `
56+ [
57+ "add",
58+ ]
59+ ` )
4760} )
0 commit comments