@@ -4,40 +4,34 @@ describe('spec', function() {
44 return ;
55 }
66
7- var _ = require ( 'underscore' ) ,
8- fs = require ( 'fs' ) ;
7+ var fs = require ( 'fs' ) ;
98
109 var specDir = __dirname + '/mustache/specs/' ;
11- var specs = _ . filter ( fs . readdirSync ( specDir ) , function ( name ) {
12- return / .* \. j s o n $ / . test ( name ) ;
13- } ) ;
10+ var specs = fs . readdirSync ( specDir ) . filter ( name => / .* \. j s o n $ / . test ( name ) ) ;
1411
15- _ . each ( specs , function ( name ) {
12+ specs . forEach ( function ( name ) {
1613 var spec = require ( specDir + name ) ;
17- _ . each ( spec . tests , function ( test ) {
18- // Our lambda implementation knowingly deviates from the optional Mustace lambda spec
19- // We also do not support alternative delimeters
14+ spec . tests . forEach ( function ( test ) {
15+ // Our lambda implementation knowingly deviates from the optional Mustache lambda spec
16+ // We also do not support alternative delimiters
2017 if (
2118 name === '~lambdas.json' ||
22- // We also choose to throw if paritals are not found
19+ // We also choose to throw if partials are not found
2320 ( name === 'partials.json' && test . name === 'Failed Lookup' ) ||
2421 // We nest the entire response from partials, not just the literals
2522 ( name === 'partials.json' && test . name === 'Standalone Indentation' ) ||
2623 / \{ \{ = / . test ( test . template ) ||
27- _ . any ( test . partials , function ( partial ) {
28- return / \{ \{ = / . test ( partial ) ;
29- } )
24+ Object . values ( test . partials || { } ) . some ( value => / \{ \{ = / . test ( value ) )
3025 ) {
3126 it . skip ( name + ' - ' + test . name ) ;
3227 return ;
3328 }
3429
35- var data = _ . clone ( test . data ) ;
30+ var data = Object . assign ( { } , test . data ) ; // Shallow copy
3631 if ( data . lambda ) {
3732 // Blergh
38- /* eslint-disable no-eval */
33+ /* eslint-disable-next-line no-eval */
3934 data . lambda = eval ( '(' + data . lambda . js + ')' ) ;
40- /* eslint-enable no-eval */
4135 }
4236 it ( name + ' - ' + test . name , function ( ) {
4337 expectTemplate ( test . template )
0 commit comments