@@ -167,25 +167,29 @@ test('hast-util-to-nlcst', function (t) {
167
167
168
168
test ( 'Fixtures' , function ( t ) {
169
169
var root = path . join ( __dirname , 'fixtures' )
170
-
171
- fs . readdirSync ( root )
172
- . filter ( negate ( hidden ) )
173
- . forEach ( function ( fixture ) {
174
- var input = path . join ( root , fixture , 'input.html' )
175
- var output = path . join ( root , fixture , 'output.json' )
176
- var file = vfile ( fs . readFileSync ( input ) )
177
- var actual = toNlcst ( rehype ( ) . parse ( file ) , file , Latin )
178
- var expected
179
-
180
- try {
181
- expected = JSON . parse ( fs . readFileSync ( output ) )
182
- } catch ( _ ) {
183
- fs . writeFileSync ( output , JSON . stringify ( actual , null , 2 ) + '\n' )
184
- return
185
- }
186
-
187
- t . deepEqual ( actual , expected , 'should work on `' + fixture + '`' )
188
- } )
170
+ var files = fs . readdirSync ( root ) . filter ( negate ( hidden ) )
171
+ var index = - 1
172
+ var input
173
+ var output
174
+ var file
175
+ var actual
176
+ var expected
177
+
178
+ while ( ++ index < files . length ) {
179
+ input = path . join ( root , files [ index ] , 'input.html' )
180
+ output = path . join ( root , files [ index ] , 'output.json' )
181
+ file = vfile ( fs . readFileSync ( input ) )
182
+ actual = toNlcst ( rehype ( ) . parse ( file ) , file , Latin )
183
+
184
+ try {
185
+ expected = JSON . parse ( fs . readFileSync ( output ) )
186
+ } catch ( _ ) {
187
+ fs . writeFileSync ( output , JSON . stringify ( actual , null , 2 ) + '\n' )
188
+ return
189
+ }
190
+
191
+ t . deepEqual ( actual , expected , 'should work on `' + files [ index ] + '`' )
192
+ }
189
193
190
194
t . end ( )
191
195
} )
0 commit comments