@@ -9,18 +9,6 @@ import { resolve } from "path"
99 * Helper function to parse JSONC (JSON with comments)
1010 * Strips single-line and multi-line comments before parsing
1111 */
12- interface TSConfig {
13- compilerOptions : {
14- target : string
15- moduleResolution : string
16- noEmit : boolean
17- strict : boolean
18- paths : Record < string , string [ ] >
19- jsx : string
20- }
21- include : string [ ]
22- }
23-
2412function parseJSONC ( content : string ) : Record < string , unknown > {
2513 // Remove single-line comments
2614 let cleaned = content . replace ( / \/ \/ .* $ / gm, "" )
@@ -68,38 +56,38 @@ describe("Configuration Verification Tests", () => {
6856
6957 describe ( "tsconfig.json" , ( ) => {
7058 it ( "should have correct target set to ES2020" , ( ) => {
71- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
59+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
7260 expect ( tsconfig . compilerOptions . target ) . toBe ( "ES2020" )
7361 } )
7462
7563 it ( "should have bundler module resolution" , ( ) => {
76- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
64+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
7765 expect ( tsconfig . compilerOptions . moduleResolution ) . toBe ( "bundler" )
7866 } )
7967
8068 it ( "should have noEmit set to true" , ( ) => {
81- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
69+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
8270 expect ( tsconfig . compilerOptions . noEmit ) . toBe ( true )
8371 } )
8472
8573 it ( "should have strict mode enabled" , ( ) => {
86- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
74+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
8775 expect ( tsconfig . compilerOptions . strict ) . toBe ( true )
8876 } )
8977
9078 it ( 'should have path alias "@/*" configured' , ( ) => {
91- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
79+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
9280 expect ( tsconfig . compilerOptions . paths ) . toHaveProperty ( "@/*" )
9381 expect ( tsconfig . compilerOptions . paths [ "@/*" ] ) . toEqual ( [ "./src/*" ] )
9482 } )
9583
9684 it ( "should have jsx set to react-jsx" , ( ) => {
97- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
85+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
9886 expect ( tsconfig . compilerOptions . jsx ) . toBe ( "react-jsx" )
9987 } )
10088
10189 it ( "should include src directory" , ( ) => {
102- const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) ) as unknown as TSConfig
90+ const tsconfig = parseJSONC ( readFileSync ( resolve ( __dirname , "../../tsconfig.json" ) , "utf-8" ) )
10391 expect ( tsconfig . include ) . toContain ( "src" )
10492 } )
10593 } )
0 commit comments