@@ -10,8 +10,7 @@ var vfile = require('to-vfile')
10
10
var Latin = require ( 'parse-latin' )
11
11
var Dutch = require ( 'parse-dutch' )
12
12
var English = require ( 'parse-english' )
13
- var negate = require ( 'negate' )
14
- var hidden = require ( 'is-hidden' )
13
+ var isHidden = require ( 'is-hidden' )
15
14
var toNlcst = require ( '..' )
16
15
17
16
test ( 'mdast-util-to-nlcst' , function ( t ) {
@@ -133,31 +132,41 @@ test('mdast-util-to-nlcst', function (t) {
133
132
134
133
test ( 'Fixtures' , function ( t ) {
135
134
var base = path . join ( __dirname , 'fixtures' )
135
+ var files = fs . readdirSync ( base )
136
+ var index = - 1
137
+ var name
138
+ var input
139
+ var expected
140
+ var mdast
141
+ var options
136
142
137
- fs . readdirSync ( base )
138
- . filter ( negate ( hidden ) )
139
- . forEach ( function ( name ) {
140
- var input = vfile . readSync ( path . join ( base , name , 'input.md' ) )
141
- var expected = JSON . parse (
142
- vfile . readSync ( path . join ( base , name , 'output.json' ) )
143
- )
144
- var options
145
-
146
- try {
147
- options = JSON . parse (
148
- vfile . readSync ( path . join ( base , name , 'options.json' ) )
149
- )
150
- } catch ( _ ) { }
143
+ while ( ++ index < files . length ) {
144
+ name = files [ index ]
151
145
152
- var mdast = remark ( )
153
- . use ( options && options . useRemarkGfm ? gfm : [ ] )
154
- . use ( options && options . useRemarkFrontmatter ? frontmatter : [ ] )
155
- . parse ( input )
146
+ if ( isHidden ( name ) ) continue
156
147
157
- var actual = toNlcst ( mdast , input , Latin , options )
148
+ input = vfile . readSync ( path . join ( base , name , 'input.md' ) )
149
+ expected = JSON . parse ( vfile . readSync ( path . join ( base , name , 'output.json' ) ) )
158
150
159
- t . deepEqual ( actual , expected , 'should work on `' + name + '`' )
160
- } )
151
+ try {
152
+ options = JSON . parse (
153
+ vfile . readSync ( path . join ( base , name , 'options.json' ) )
154
+ )
155
+ } catch ( _ ) {
156
+ options = null
157
+ }
158
+
159
+ mdast = remark ( )
160
+ . use ( options && options . useRemarkGfm ? gfm : [ ] )
161
+ . use ( options && options . useRemarkFrontmatter ? frontmatter : [ ] )
162
+ . parse ( input )
163
+
164
+ t . deepEqual (
165
+ toNlcst ( mdast , input , Latin , options ) ,
166
+ expected ,
167
+ 'should work on `' + name + '`'
168
+ )
169
+ }
161
170
162
171
t . end ( )
163
172
} )
0 commit comments