File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,14 @@ export default function populatePlaceholders(
1515 if (
1616 ! Object . prototype . hasOwnProperty . call ( replacements , placeholder . name )
1717 ) {
18- throw new Error ( `No substitution given for "${ placeholder . name } "` ) ;
18+ const placeholderName = placeholder . name ;
19+
20+ throw new Error (
21+ `Error: No substitution given for "${ placeholderName } ". If this is not meant to be a
22+ placeholder you may want to consider passing one of the following options to babel-template:
23+ - { placeholderPattern: false, placeholderWhitelist: new Set(['${ placeholderName } '])}
24+ - { placeholderPattern: /^${ placeholderName } $/ }` ,
25+ ) ;
1926 }
2027 } ) ;
2128 Object . keys ( replacements ) . forEach ( key => {
Original file line number Diff line number Diff line change @@ -133,7 +133,13 @@ describe("babel-template", function() {
133133 ID;
134134 ANOTHER_ID;
135135 ` ) ( { ID : t . identifier ( "someIdent" ) } ) ;
136- } ) . to . throw ( Error , 'No substitution given for "ANOTHER_ID"' ) ;
136+ } ) . to . throw (
137+ Error ,
138+ `Error: No substitution given for "ANOTHER_ID". If this is not meant to be a
139+ placeholder you may want to consider passing one of the following options to babel-template:
140+ - { placeholderPattern: false, placeholderWhitelist: new Set(['ANOTHER_ID'])}
141+ - { placeholderPattern: /^ANOTHER_ID$/ }` ,
142+ ) ;
137143 } ) ;
138144
139145 it ( "should return the AST directly when using .ast" , ( ) => {
You can’t perform that action at this time.
0 commit comments