File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 822
822
done ( ) ;
823
823
} ) ;
824
824
} ) ;
825
+
826
+ it ( 'should include error line when exception raised in user function' , function ( done ) {
827
+ var tmplStr = [
828
+ '{% block content %}' ,
829
+ '<div>{{ foo() }}</div>' ,
830
+ '{% endblock %}' ,
831
+ ] . join ( '\n' ) ;
832
+ var env = new Environment ( new Loader ( 'tests/templates' ) ) ;
833
+ var tmpl = new Template ( tmplStr , env , 'user-error.njk' ) ;
834
+
835
+ function foo ( ) {
836
+ throw new Error ( 'ERROR' ) ;
837
+ }
838
+
839
+ tmpl . render ( { foo : foo } , function ( err , res ) {
840
+ expect ( res ) . to . be ( undefined ) ;
841
+ expect ( err . toString ( ) ) . to . be ( [
842
+ 'Template render error: (user-error.njk) [Line 1, Column 11]' ,
843
+ ' Error: ERROR' ,
844
+ ] . join ( '\n' ) ) ;
845
+ done ( ) ;
846
+ } ) ;
847
+ } ) ;
825
848
}
826
849
827
850
it ( 'should compile string concatenations with tilde' , function ( done ) {
You can’t perform that action at this time.
0 commit comments