77
88import * as fs from 'fs' ;
99import * as path from 'path' ;
10+ import type { FormattedTestResults } from '@jest/test-result' ;
1011import runJest from '../runJest' ;
1112
1213describe ( 'JSON Reporter' , ( ) => {
@@ -22,7 +23,7 @@ describe('JSON Reporter', () => {
2223 } ) ;
2324
2425 it ( 'writes test result to sum.result.json' , ( ) => {
25- let jsonResult ;
26+ let jsonResult : FormattedTestResults ;
2627
2728 runJest ( 'json-reporter' , [ '--json' , `--outputFile=${ outputFileName } ` ] ) ;
2829 const testOutput = fs . readFileSync ( outputFilePath , 'utf8' ) ;
@@ -45,7 +46,7 @@ describe('JSON Reporter', () => {
4546 const noAncestors = jsonResult . testResults [ 0 ] . assertionResults . find (
4647 item => item . title == 'no ancestors' ,
4748 ) ;
48- let expected = { ancestorTitles : [ ] } ;
49+ let expected = { ancestorTitles : [ ] as Array < string > } ;
4950 expect ( noAncestors ) . toEqual ( expect . objectContaining ( expected ) ) ;
5051
5152 const addsNumbers = jsonResult . testResults [ 0 ] . assertionResults . find (
@@ -63,7 +64,7 @@ describe('JSON Reporter', () => {
6364
6465 it ( 'outputs coverage report' , ( ) => {
6566 const result = runJest ( 'json-reporter' , [ '--json' ] ) ;
66- let jsonResult ;
67+ let jsonResult : FormattedTestResults ;
6768
6869 expect ( result . stderr ) . toMatch ( / 1 f a i l e d , 2 p a s s e d / ) ;
6970 expect ( result . exitCode ) . toBe ( 1 ) ;
@@ -86,7 +87,7 @@ describe('JSON Reporter', () => {
8687 const noAncestors = jsonResult . testResults [ 0 ] . assertionResults . find (
8788 item => item . title == 'no ancestors' ,
8889 ) ;
89- let expected = { ancestorTitles : [ ] } ;
90+ let expected = { ancestorTitles : [ ] as Array < string > } ;
9091 expect ( noAncestors ) . toEqual ( expect . objectContaining ( expected ) ) ;
9192
9293 const addsNumbers = jsonResult . testResults [ 0 ] . assertionResults . find (
0 commit comments