11/* global jasmine */
22
3- var path = require ( 'path' ) ,
4- os = require ( 'os' ) ,
5- exec = require ( 'child_process' ) . exec ,
6- tmp = require ( 'tmp' ) ,
7- fs = require ( 'fs-extra' ) ;
3+ const path = require ( 'path' ) ;
4+ const os = require ( 'os' ) ;
5+ const exec = require ( 'child_process' ) . exec ;
6+ const tmp = require ( 'tmp' ) ;
7+ const fs = require ( 'fs-extra' ) ;
88
99jasmine . DEFAULT_TIMEOUT_INTERVAL = 10000 ;
1010
@@ -160,9 +160,9 @@ describe('invalid arguments', function() {
160160} ) ;
161161
162162test ( '--config' , async function ( ) {
163- var dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
163+ const dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
164164 fs . mkdirSync ( dst ) ;
165- var outputIndex = path . join ( dst , 'index.html' ) ;
165+ const outputIndex = path . join ( dst , 'index.html' ) ;
166166 const data = await documentation (
167167 [
168168 'build -c fixture/html/documentation.yml -f html fixture/html/nested.input.js -o ' +
@@ -171,7 +171,7 @@ test('--config', async function() {
171171 { } ,
172172 false
173173 ) ;
174- var output = fs . readFileSync ( outputIndex , 'utf8' ) ;
174+ const output = fs . readFileSync ( outputIndex , 'utf8' ) ;
175175 expect ( output ) . toMatchSnapshot ( ) ;
176176} ) ;
177177
@@ -185,7 +185,11 @@ describe('lint command', function() {
185185 try {
186186 await documentation ( [ 'lint fixture/lint/lint.input.js' ] , { } , false ) ;
187187 } catch ( err ) {
188- var data = err . stderr . toString ( ) . split ( '\n' ) . slice ( 2 ) . join ( '\n' ) ;
188+ const data = err . stderr
189+ . toString ( )
190+ . split ( '\n' )
191+ . slice ( 2 )
192+ . join ( '\n' ) ;
189193 expect ( data ) . toMatchSnapshot ( ) ;
190194 }
191195 } ) ;
@@ -284,7 +288,7 @@ test('--infer-private flag', async function() {
284288} ) ;
285289
286290test ( 'write to file' , async function ( ) {
287- var dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
291+ const dst = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
288292
289293 const data = await documentation (
290294 [ 'build --shallow fixture/internal.input.js -o ' + dst ] ,
@@ -296,7 +300,10 @@ test('write to file', async function() {
296300} ) ;
297301
298302test ( 'write to html' , async function ( ) {
299- var dstDir = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
303+ const dstDir = path . join (
304+ os . tmpdir ( ) ,
305+ ( Date . now ( ) + Math . random ( ) ) . toString ( )
306+ ) ;
300307 fs . mkdirSync ( dstDir ) ;
301308
302309 const data = await documentation (
@@ -309,7 +316,10 @@ test('write to html', async function() {
309316} ) ;
310317
311318test ( 'write to html with custom theme' , async function ( ) {
312- var dstDir = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
319+ const dstDir = path . join (
320+ os . tmpdir ( ) ,
321+ ( Date . now ( ) + Math . random ( ) ) . toString ( )
322+ ) ;
313323 fs . mkdirSync ( dstDir ) ;
314324
315325 const data = await documentation (
@@ -325,9 +335,12 @@ test('write to html with custom theme', async function() {
325335} ) ;
326336
327337test ( 'write to html, highlightAuto' , function ( ) {
328- var fixture = 'fixture/auto_lang_hljs/multilanguage.input.js' ,
329- config = 'fixture/auto_lang_hljs/config.yml' ,
330- dstDir = path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) ;
338+ const fixture = 'fixture/auto_lang_hljs/multilanguage.input.js' ;
339+ const config = 'fixture/auto_lang_hljs/config.yml' ;
340+ const dstDir = path . join (
341+ os . tmpdir ( ) ,
342+ ( Date . now ( ) + Math . random ( ) ) . toString ( )
343+ ) ;
331344
332345 fs . mkdirSync ( dstDir ) ;
333346
@@ -336,7 +349,7 @@ test('write to html, highlightAuto', function() {
336349 { } ,
337350 false
338351 ) . then ( ( ) => {
339- var result = fs . readFileSync ( path . join ( dstDir , 'index.html' ) , 'utf8' ) ;
352+ const result = fs . readFileSync ( path . join ( dstDir , 'index.html' ) , 'utf8' ) ;
340353 expect (
341354 result . indexOf ( '<span class="hljs-number">42</span>' ) > 0
342355 ) . toBeTruthy ( ) ;
@@ -371,10 +384,10 @@ test('build --document-exported', async function() {
371384} ) ;
372385
373386test ( 'build large file without error (no deoptimized styling error)' , function ( ) {
374- var dstFile =
387+ const dstFile =
375388 path . join ( os . tmpdir ( ) , ( Date . now ( ) + Math . random ( ) ) . toString ( ) ) + '.js' ;
376- var contents = '' ;
377- for ( var i = 0 ; i < 4e4 ; i ++ ) {
389+ let contents = '' ;
390+ for ( let i = 0 ; i < 4e4 ; i ++ ) {
378391 contents += '/* - */\n' ;
379392 }
380393 fs . writeFileSync ( dstFile , contents , 'utf8' ) ;
0 commit comments