1+ /* global console */
12var test = require ( 'tape' ) ;
23var HTML = require ( '../index' ) ;
34
45
56test ( 'parse' , function ( t ) {
67 var html = '<div class="oh"><p></p></div>' ;
7- var parsed = HTML . parse ( html ) ;
8+ var parsed = HTML . parse ( html ) ;
89 t . deepEqual ( parsed , [ {
910 type : 'tag' ,
1011 name : 'div' ,
@@ -278,12 +279,13 @@ test('simple speed sanity check', function (t) {
278279 var waitLoopSize = 10000000 ;
279280 var groups = i / groupSize ;
280281 var html = '<html><head><title>Some page</title></head><body class="hey there"><img src="someURL"><h3>Hey, we need content</h3><br></body></html>' ;
281-
282+
282283 var parse = HTML . parse ;
283284 var times = [ ] ;
284285 var count ;
285286 var waitCount ;
286287 var total = 0 ;
288+ var start , stepAverage ;
287289
288290 console . log ( 'running ' + i + ' iterations...' ) ;
289291
@@ -296,10 +298,10 @@ test('simple speed sanity check', function (t) {
296298 parse ( html ) ;
297299 }
298300 var diff = Date . now ( ) - start ;
299- var average = diff / groupSize
300- console . log ( 'group ' + ( groups - ( i / groupSize ) ) + ': ' + average ) ;
301- times . push ( average ) ;
302- total += average ;
301+ stepAverage = diff / groupSize ;
302+ console . log ( 'group ' + ( groups - ( i / groupSize ) ) + ': ' + stepAverage ) ;
303+ times . push ( stepAverage ) ;
304+ total += stepAverage ;
303305 waitCount = waitLoopSize ;
304306 // forcing a bit of a pause between tests
305307 while ( waitCount -- ) { }
@@ -308,8 +310,8 @@ test('simple speed sanity check', function (t) {
308310 }
309311
310312 // trim off first
311- // it's always a slower outlier
312- // with higher variability that
313+ // it's always a slower outlier
314+ // with higher variability that
313315 // makes it harder to find differences
314316 times . shift ( ) ;
315317
@@ -320,6 +322,6 @@ test('simple speed sanity check', function (t) {
320322 console . log ( 'max' , max ) ;
321323 console . log ( 'min' , min ) ;
322324 console . log ( 'avg' , average ) ;
323-
325+
324326 t . end ( ) ;
325327} ) ;
0 commit comments