@@ -83,8 +83,8 @@ describe('precompiler', function () {
8383 console . error = errorLogFunction ;
8484 } ) ;
8585
86- it ( 'should output version' , function ( ) {
87- Precompiler . cli ( { templates : [ ] , version : true } ) ;
86+ it ( 'should output version' , async function ( ) {
87+ await Precompiler . cli ( { templates : [ ] , version : true } ) ;
8888 expect ( log ) . toBe ( Handlebars . VERSION ) ;
8989 } ) ;
9090 it ( 'should throw if lacking templates' , async function ( ) {
@@ -93,6 +93,9 @@ describe('precompiler', function () {
9393 ) ;
9494 } ) ;
9595 it ( 'should handle empty/filtered directories' , async function ( ) {
96+ Handlebars . precompile = function ( ) {
97+ return 'simple' ;
98+ } ;
9699 await Precompiler . cli ( { hasDirectory : true , templates : [ ] } ) ;
97100 // Success is not throwing
98101 } ) ;
@@ -123,32 +126,32 @@ describe('precompiler', function () {
123126 ) . rejects . toThrow ( 'Unable to output multiple templates in simple mode' ) ;
124127 } ) ;
125128
126- it ( 'should output simple templates' , function ( ) {
129+ it ( 'should output simple templates' , async function ( ) {
127130 Handlebars . precompile = function ( ) {
128131 return 'simple' ;
129132 } ;
130- Precompiler . cli ( { templates : [ emptyTemplate ] , simple : true } ) ;
133+ await Precompiler . cli ( { templates : [ emptyTemplate ] , simple : true } ) ;
131134 expect ( log ) . toBe ( 'simple\n' ) ;
132135 } ) ;
133- it ( 'should default to simple templates' , function ( ) {
136+ it ( 'should default to simple templates' , async function ( ) {
134137 Handlebars . precompile = function ( ) {
135138 return 'simple' ;
136139 } ;
137- Precompiler . cli ( { templates : [ { source : '' } ] } ) ;
140+ await Precompiler . cli ( { templates : [ { source : '' } ] } ) ;
138141 expect ( log ) . toBe ( 'simple\n' ) ;
139142 } ) ;
140- it ( 'should output amd templates' , function ( ) {
143+ it ( 'should output amd templates' , async function ( ) {
141144 Handlebars . precompile = function ( ) {
142145 return 'amd' ;
143146 } ;
144- Precompiler . cli ( { templates : [ emptyTemplate ] , amd : true } ) ;
147+ await Precompiler . cli ( { templates : [ emptyTemplate ] , amd : true } ) ;
145148 expect ( log ) . toMatch ( / t e m p l a t e \( a m d \) / ) ;
146149 } ) ;
147- it ( 'should output multiple amd' , function ( ) {
150+ it ( 'should output multiple amd' , async function ( ) {
148151 Handlebars . precompile = function ( ) {
149152 return 'amd' ;
150153 } ;
151- Precompiler . cli ( {
154+ await Precompiler . cli ( {
152155 templates : [ emptyTemplate , emptyTemplate ] ,
153156 amd : true ,
154157 namespace : 'foo' ,
@@ -157,56 +160,68 @@ describe('precompiler', function () {
157160 expect ( log ) . toMatch ( / r e t u r n t e m p l a t e s / ) ;
158161 expect ( log ) . toMatch ( / t e m p l a t e \( a m d \) / ) ;
159162 } ) ;
160- it ( 'should output amd partials' , function ( ) {
163+ it ( 'should output amd partials' , async function ( ) {
161164 Handlebars . precompile = function ( ) {
162165 return 'amd' ;
163166 } ;
164- Precompiler . cli ( { templates : [ emptyTemplate ] , amd : true , partial : true } ) ;
167+ await Precompiler . cli ( {
168+ templates : [ emptyTemplate ] ,
169+ amd : true ,
170+ partial : true ,
171+ } ) ;
165172 expect ( log ) . toMatch ( / r e t u r n H a n d l e b a r s \. p a r t i a l s \[ ' e m p t y ' \] / ) ;
166173 expect ( log ) . toMatch ( / t e m p l a t e \( a m d \) / ) ;
167174 } ) ;
168- it ( 'should output multiple amd partials' , function ( ) {
175+ it ( 'should output multiple amd partials' , async function ( ) {
169176 Handlebars . precompile = function ( ) {
170177 return 'amd' ;
171178 } ;
172- Precompiler . cli ( {
179+ await Precompiler . cli ( {
173180 templates : [ emptyTemplate , emptyTemplate ] ,
174181 amd : true ,
175182 partial : true ,
176183 } ) ;
177184 expect ( log ) . not . toMatch ( / r e t u r n H a n d l e b a r s \. p a r t i a l s \[ / ) ;
178185 expect ( log ) . toMatch ( / t e m p l a t e \( a m d \) / ) ;
179186 } ) ;
180- it ( 'should output commonjs templates' , function ( ) {
187+ it ( 'should output commonjs templates' , async function ( ) {
181188 Handlebars . precompile = function ( ) {
182189 return 'commonjs' ;
183190 } ;
184- Precompiler . cli ( { templates : [ emptyTemplate ] , commonjs : true } ) ;
191+ await Precompiler . cli ( { templates : [ emptyTemplate ] , commonjs : true } ) ;
185192 expect ( log ) . toMatch ( / t e m p l a t e \( c o m m o n j s \) / ) ;
186193 } ) ;
187194
188- it ( 'should set data flag' , function ( ) {
195+ it ( 'should set data flag' , async function ( ) {
189196 Handlebars . precompile = function ( data , options ) {
190197 expect ( options . data ) . toBe ( true ) ;
191198 return 'simple' ;
192199 } ;
193- Precompiler . cli ( { templates : [ emptyTemplate ] , simple : true , data : true } ) ;
200+ await Precompiler . cli ( {
201+ templates : [ emptyTemplate ] ,
202+ simple : true ,
203+ data : true ,
204+ } ) ;
194205 expect ( log ) . toBe ( 'simple\n' ) ;
195206 } ) ;
196207
197- it ( 'should set known helpers' , function ( ) {
208+ it ( 'should set known helpers' , async function ( ) {
198209 Handlebars . precompile = function ( data , options ) {
199210 expect ( options . knownHelpers . foo ) . toBe ( true ) ;
200211 return 'simple' ;
201212 } ;
202- Precompiler . cli ( { templates : [ emptyTemplate ] , simple : true , known : 'foo' } ) ;
213+ await Precompiler . cli ( {
214+ templates : [ emptyTemplate ] ,
215+ simple : true ,
216+ known : 'foo' ,
217+ } ) ;
203218 expect ( log ) . toBe ( 'simple\n' ) ;
204219 } ) ;
205- it ( 'should output to file system' , function ( ) {
220+ it ( 'should output to file system' , async function ( ) {
206221 Handlebars . precompile = function ( ) {
207222 return 'simple' ;
208223 } ;
209- Precompiler . cli ( {
224+ await Precompiler . cli ( {
210225 templates : [ emptyTemplate ] ,
211226 simple : true ,
212227 output : 'file!' ,
@@ -216,14 +231,14 @@ describe('precompiler', function () {
216231 expect ( log ) . toBe ( '' ) ;
217232 } ) ;
218233
219- it ( 'should output minimized templates' , function ( ) {
234+ it ( 'should output minimized templates' , async function ( ) {
220235 Handlebars . precompile = function ( ) {
221236 return 'amd' ;
222237 } ;
223238 uglify . minify = function ( ) {
224239 return { code : 'min' } ;
225240 } ;
226- Precompiler . cli ( { templates : [ emptyTemplate ] , min : true } ) ;
241+ await Precompiler . cli ( { templates : [ emptyTemplate ] , min : true } ) ;
227242 expect ( log ) . toBe ( 'min' ) ;
228243 } ) ;
229244
0 commit comments