66 filterAuditsByCompilerOptions ,
77 filterAuditsBySlug ,
88 handleCompilerOptionStrict ,
9+ normalizeCompilerOptions ,
910 validateAudits ,
1011} from './utils.js' ;
1112
@@ -93,17 +94,15 @@ describe('handleCompilerOptionStrict', () => {
9394 it ( 'should return original options when strict is false' , ( ) => {
9495 const options : CompilerOptions = {
9596 strict : false ,
96- target : 2 ,
9797 } ;
9898
9999 const result = handleCompilerOptionStrict ( options ) ;
100- expect ( result ) . toB ( options ) ;
100+ expect ( result ) . toBe ( options ) ;
101101 } ) ;
102102
103103 it ( 'should add all strict options when strict is true' , ( ) => {
104104 const options : CompilerOptions = {
105105 strict : true ,
106- target : 2 ,
107106 } ;
108107
109108 const result = handleCompilerOptionStrict ( options ) ;
@@ -121,17 +120,29 @@ describe('handleCompilerOptionStrict', () => {
121120 } ) ;
122121 } ) ;
123122
123+ it ( 'should add all strict options when strict is true and override existing value' , ( ) => {
124+ const options : CompilerOptions = {
125+ strict : true ,
126+ noImplicitAny : false ,
127+ } ;
128+
129+ const result = handleCompilerOptionStrict ( options ) ;
130+
131+ expect ( result . noImplicitAny ) . toBe ( true ) ;
132+ } ) ;
133+
124134 it ( 'should preserve existing option values while adding strict options' , ( ) => {
125135 const options : CompilerOptions = {
126136 strict : true ,
127137 target : 2 ,
128- noImplicitAny : false ,
138+ verbatimModuleSyntax : false ,
129139 } ;
130140
131141 const result = handleCompilerOptionStrict ( options ) ;
132142
143+ expect ( result . strict ) . toBe ( true ) ;
133144 expect ( result . target ) . toBe ( 2 ) ;
134- expect ( result . noImplicitAny ) . toBe ( true ) ;
145+ expect ( result . verbatimModuleSyntax ) . toBe ( false ) ;
135146 } ) ;
136147} ) ;
137148
@@ -147,23 +158,28 @@ describe('validateAudits', () => {
147158 } ) ;
148159
149160 it ( 'should not warn when all audits are included' , ( ) => {
150- const filteredAudits = AUDITS . map ( audit => ( { ...audit } ) ) ;
151-
152- validateAudits ( filteredAudits ) ;
161+ validateAudits ( AUDITS ) ;
153162
154163 expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
155164 } ) ;
156165
157166 it ( 'should warn about skipped audits' , ( ) => {
158- const filteredAudits = AUDITS . slice ( 1 ) ; // Removes an audit
159- validateAudits ( filteredAudits ) ;
167+ validateAudits ( AUDITS . slice ( 0 , - 1 ) ) ;
160168
161- expect ( console . warn ) . toHaveBeenCalled ( ) ;
169+ expect ( console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
170+ expect ( console . warn ) . toHaveBeenCalledWith (
171+ expect . stringContaining (
172+ `Skipped audits because the compiler options disabled: [` ,
173+ ) ,
174+ ) ;
162175 } ) ;
163176
164- it ( 'should warn of all audits when filteredAudits are empty ' , ( ) => {
165- validateAudits ( [ ] ) ;
177+ it ( 'should camel case the slugs in the audit message ' , ( ) => {
178+ validateAudits ( AUDITS . slice ( 0 , - 1 ) ) ;
166179
167- expect ( console . warn ) . toHaveBeenCalled ( ) ;
180+ expect ( console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
181+ expect ( console . warn ) . toHaveBeenCalledWith (
182+ expect . stringContaining ( `strictFunctionTypes` ) ,
183+ ) ;
168184 } ) ;
169185} ) ;
0 commit comments