@@ -20,6 +20,11 @@ function node(name: string, originName?: string): ParsedNode {
2020 } ;
2121}
2222
23+ function unsafeNestedQuantifierPattern ( ) : string {
24+ const plus = String . fromCharCode ( 43 ) ;
25+ return `(a${ plus } )${ plus } $` ;
26+ }
27+
2328describe ( "node name filter config" , ( ) => {
2429 it ( "treats a missing config as disabled and disables an empty enabled config" , ( ) => {
2530 expect ( parseNodeNameFilterConfig ( undefined ) ) . toEqual ( {
@@ -64,7 +69,7 @@ describe("node name filter config", () => {
6469 it ( "reports the original line for invalid, unsafe, and non-string rules" , ( ) => {
6570 const result = validateNodeNameFilterConfig ( {
6671 enabled : true ,
67- excludeRegexes : [ "valid" , 123 , "[" , "(a+)+$" ] ,
72+ excludeRegexes : [ "valid" , 123 , "[" , unsafeNestedQuantifierPattern ( ) ] ,
6873 } ) ;
6974
7075 expect ( result ) . toEqual ( {
@@ -126,7 +131,10 @@ describe("node name filter config", () => {
126131 ) ;
127132
128133 try {
129- parseNodeNameFilterConfig ( { enabled : true , excludeRegexes : [ "(" , "(a+)+$" ] } ) ;
134+ parseNodeNameFilterConfig ( {
135+ enabled : true ,
136+ excludeRegexes : [ "(" , unsafeNestedQuantifierPattern ( ) ] ,
137+ } ) ;
130138 throw new Error ( "Expected parsing to fail" ) ;
131139 } catch ( error ) {
132140 expect ( error ) . toBeInstanceOf ( NodeNameFilterConfigError ) ;
@@ -198,7 +206,7 @@ describe("resolveNodeNameFilter", () => {
198206 expect ( ( ) =>
199207 resolveNodeNameFilter ( [ node ( "Node" ) ] , {
200208 enabled : true ,
201- excludeRegexes : [ "(a+)+$" ] ,
209+ excludeRegexes : [ unsafeNestedQuantifierPattern ( ) ] ,
202210 } )
203211 ) . toThrow ( NodeNameFilterConfigError ) ;
204212 } ) ;
0 commit comments