@@ -42,23 +42,23 @@ function normalize(result) {
42
42
43
43
var options = { timeout : 1000 * 120 } ;
44
44
45
- test ( 'documentation binary' , function ( t ) {
45
+ test ( 'documentation binary' , options , function ( t ) {
46
46
documentation ( [ 'build fixture/simple.input.js' ] , function ( err , data ) {
47
47
t . error ( err ) ;
48
48
t . equal ( data . length , 1 , 'simple has no dependencies' ) ;
49
49
t . end ( ) ;
50
50
} ) ;
51
- } , options ) ;
51
+ } ) ;
52
52
53
- test ( 'defaults to parsing package.json main' , function ( t ) {
53
+ test ( 'defaults to parsing package.json main' , options , function ( t ) {
54
54
documentation ( [ 'build' ] , { cwd : path . join ( __dirname , '..' ) } , function ( err , data ) {
55
55
t . error ( err ) ;
56
56
t . ok ( data . length , 'we document ourself' ) ;
57
57
t . end ( ) ;
58
58
} ) ;
59
- } , options ) ;
59
+ } ) ;
60
60
61
- test ( 'polyglot mode' , function ( t ) {
61
+ test ( 'polyglot mode' , options , function ( t ) {
62
62
documentation ( [ 'build fixture/polyglot/blend.cpp --polyglot' ] ,
63
63
function ( err , data ) {
64
64
t . ifError ( err ) ;
@@ -78,9 +78,9 @@ test('polyglot mode', function (t) {
78
78
'parsed C++ file' ) ;
79
79
t . end ( ) ;
80
80
} ) ;
81
- } , options ) ;
81
+ } ) ;
82
82
83
- test ( 'accepts config file' , function ( t ) {
83
+ test ( 'accepts config file' , options , function ( t ) {
84
84
documentation ( [ 'build fixture/sorting/input.js -c fixture/config.json' ] ,
85
85
function ( err , data ) {
86
86
t . error ( err ) ;
@@ -100,9 +100,9 @@ test('accepts config file', function (t) {
100
100
'respected sort order from config file' ) ;
101
101
t . end ( ) ;
102
102
} ) ;
103
- } , options ) ;
103
+ } ) ;
104
104
105
- test ( 'accepts config file - reports failures' , function ( t ) {
105
+ test ( 'accepts config file - reports failures' , options , function ( t ) {
106
106
documentation ( [ 'build fixture/sorting/input.js -c fixture/config-bad.yml' ] , { } ,
107
107
function ( err , data , stderr ) {
108
108
t . error ( err ) ;
@@ -119,15 +119,15 @@ test('accepts config file - reports failures', function (t) {
119
119
t . equal ( stderr , expected , 'reported a missing toc entry' ) ;
120
120
t . end ( ) ;
121
121
} , false ) ;
122
- } , options ) ;
122
+ } ) ;
123
123
124
124
test ( '--shallow option' , function ( t ) {
125
125
documentation ( [ 'build --shallow fixture/internal.input.js' ] , function ( err , data ) {
126
126
t . error ( err ) ;
127
127
t . equal ( data . length , 0 , 'should not check dependencies' ) ;
128
128
t . end ( ) ;
129
129
} ) ;
130
- } , options ) ;
130
+ } ) ;
131
131
132
132
test ( 'external modules option' , function ( t ) {
133
133
documentation ( [ 'build fixture/external.input.js ' +
@@ -155,21 +155,21 @@ test('extension option', function (t) {
155
155
} ) ;
156
156
157
157
test ( 'invalid arguments' , function ( group ) {
158
- group . test ( 'bad -f option' , function ( t ) {
158
+ group . test ( 'bad -f option' , options , function ( t ) {
159
159
documentation ( [ 'build -f DOES-NOT-EXIST fixture/internal.input.js' ] , function ( err ) {
160
160
t . ok ( err , 'returns error' ) ;
161
161
t . end ( ) ;
162
162
} ) ;
163
- } , options ) ;
163
+ } ) ;
164
164
165
- group . test ( 'html with no destination' , function ( t ) {
165
+ group . test ( 'html with no destination' , options , function ( t ) {
166
166
documentation ( [ 'build -f html fixture/internal.input.js' ] , function ( err ) {
167
167
t . ok ( err . toString ( )
168
168
. match ( / T h e H T M L o u t p u t m o d e r e q u i r e s a d e s t i n a t i o n d i r e c t o r y s e t w i t h - o / ) ,
169
169
'needs dest for html' ) ;
170
170
t . end ( ) ;
171
171
} ) ;
172
- } , options ) ;
172
+ } ) ;
173
173
174
174
group . test ( 'bad command' , function ( t ) {
175
175
documentation ( [ '-f html fixture/internal.input.js' ] , function ( err , stdout , stderr ) {
@@ -182,16 +182,16 @@ test('invalid arguments', function (group) {
182
182
group . end ( ) ;
183
183
} ) ;
184
184
185
- test ( '--version' , function ( t ) {
185
+ test ( '--version' , options , function ( t ) {
186
186
documentation ( [ '--version' ] , { } , function ( err , output ) {
187
187
t . ok ( output , 'outputs version' ) ;
188
188
t . end ( ) ;
189
189
} , false ) ;
190
- } , options ) ;
190
+ } ) ;
191
191
192
192
test ( 'lint command' , function ( group ) {
193
193
194
- group . test ( 'generates lint output' , function ( t ) {
194
+ group . test ( 'generates lint output' , options , function ( t ) {
195
195
documentation ( [ 'lint fixture/lint/lint.input.js' ] , function ( err , data ) {
196
196
var output = path . join ( __dirname , 'fixture/lint/lint.output.js' ) ;
197
197
data = data . toString ( ) . split ( '\n' ) . slice ( 2 ) . join ( '\n' ) ;
@@ -202,41 +202,41 @@ test('lint command', function (group) {
202
202
t . equal ( data , fs . readFileSync ( output , 'utf8' ) , 'outputs lint' ) ;
203
203
t . end ( ) ;
204
204
} ) ;
205
- } , options ) ;
205
+ } ) ;
206
206
207
- group . test ( 'generates no output on a good file' , function ( t ) {
207
+ group . test ( 'generates no output on a good file' , options , function ( t ) {
208
208
documentation ( [ 'lint fixture/simple.input.js' ] , { } , function ( err , data ) {
209
209
t . equal ( err , null ) ;
210
210
t . equal ( data , '' , 'no output' ) ;
211
211
t . end ( ) ;
212
212
} , false ) ;
213
- } , options ) ;
213
+ } ) ;
214
214
215
- group . test ( 'exposes syntax error on a bad file' , function ( t ) {
215
+ group . test ( 'exposes syntax error on a bad file' , options , function ( t ) {
216
216
documentation ( [ 'lint fixture/bad/syntax.input.js' ] , { } , function ( err , data ) {
217
217
t . ok ( err . code > 0 , 'exits with a > 0 exit code' ) ;
218
218
t . end ( ) ;
219
219
} , false ) ;
220
- } , options ) ;
220
+ } ) ;
221
221
222
222
group . end ( ) ;
223
223
} ) ;
224
224
225
- test ( 'given no files' , function ( t ) {
225
+ test ( 'given no files' , options , function ( t ) {
226
226
documentation ( [ 'build' ] , function ( err ) {
227
227
t . ok ( err . toString ( )
228
228
. match ( / d o c u m e n t a t i o n w a s g i v e n n o f i l e s a n d w a s n o t r u n i n a m o d u l e d i r e c t o r y / ) ,
229
229
'no files given' ) ;
230
230
t . end ( ) ;
231
231
} ) ;
232
- } , options ) ;
232
+ } ) ;
233
233
234
- test ( 'with an invalid command' , function ( t ) {
234
+ test ( 'with an invalid command' , options , function ( t ) {
235
235
documentation ( [ 'invalid' ] , function ( err ) {
236
236
t . ok ( err , 'returns error' ) ;
237
237
t . end ( ) ;
238
238
} ) ;
239
- } , options ) ;
239
+ } ) ;
240
240
241
241
test ( '--access flag' , function ( t ) {
242
242
documentation ( [ 'build --shallow fixture/internal.input.js -a public' ] , { } , function ( err , data ) {
@@ -271,7 +271,7 @@ test('--infer-private flag', function (t) {
271
271
} , false ) ;
272
272
} ) ;
273
273
274
- test ( 'write to file' , function ( t ) {
274
+ test ( 'write to file' , options , function ( t ) {
275
275
276
276
var dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
277
277
@@ -281,9 +281,9 @@ test('write to file', function (t) {
281
281
t . ok ( fs . existsSync ( dst ) , 'created file' ) ;
282
282
t . end ( ) ;
283
283
} , false ) ;
284
- } , options ) ;
284
+ } ) ;
285
285
286
- test ( 'write to html' , function ( t ) {
286
+ test ( 'write to html' , options , function ( t ) {
287
287
288
288
var dstDir = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
289
289
fs . mkdirSync ( dstDir ) ;
@@ -295,9 +295,9 @@ test('write to html', function (t) {
295
295
t . ok ( fs . existsSync ( path . join ( dstDir , 'index.html' ) ) , 'created index.html' ) ;
296
296
t . end ( ) ;
297
297
} , false ) ;
298
- } , options ) ;
298
+ } ) ;
299
299
300
- test ( 'write to html with custom theme' , function ( t ) {
300
+ test ( 'write to html with custom theme' , options , function ( t ) {
301
301
302
302
var dstDir = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
303
303
fs . mkdirSync ( dstDir ) ;
@@ -309,9 +309,9 @@ test('write to html with custom theme', function (t) {
309
309
t . ok ( fs . readFileSync ( path . join ( dstDir , 'index.html' ) , 'utf8' ) , 'Hello world' ) ;
310
310
t . end ( ) ;
311
311
} , false ) ;
312
- } , options ) ;
312
+ } ) ;
313
313
314
- test ( 'write to html, highlightAuto' , function ( t ) {
314
+ test ( 'write to html, highlightAuto' , options , function ( t ) {
315
315
316
316
var fixture = 'fixture/auto_lang_hljs/multilanguage.input.js' ,
317
317
config = 'fixture/auto_lang_hljs/config.yml' ,
@@ -331,13 +331,13 @@ test('write to html, highlightAuto', function (t) {
331
331
'html is recognized by highlightjs' ) ;
332
332
t . end ( ) ;
333
333
} , false ) ;
334
- } , options ) ;
334
+ } ) ;
335
335
336
- test ( 'fatal error' , function ( t ) {
336
+ test ( 'fatal error' , options , function ( t ) {
337
337
338
338
documentation ( [ 'build --shallow fixture/bad/syntax.input.js' ] , { } ,
339
339
function ( err ) {
340
340
t . ok ( err . toString ( ) . match ( / U n e x p e c t e d t o k e n / ) , 'reports syntax error' ) ;
341
341
t . end ( ) ;
342
342
} , false ) ;
343
- } , options ) ;
343
+ } ) ;
0 commit comments