1- 'use strict'
2-
3- var fs = require ( 'fs' )
4- var path = require ( 'path' )
5- var assert = require ( 'assert' )
6- var test = require ( 'tape' )
7- var not = require ( 'not' )
8- var hidden = require ( 'is-hidden' )
9- var vfile = require ( 'to-vfile' )
10- var parse5 = require ( 'parse5' )
11- var visit = require ( 'unist-util-visit' )
12- var fromParse5 = require ( '..' )
1+ import fs from 'fs'
2+ import path from 'path'
3+ import assert from 'assert'
4+ import test from 'tape'
5+ import { isHidden } from 'is-hidden'
6+ import parse5 from 'parse5'
7+ import { visit } from 'unist-util-visit'
8+ import vfile from 'to-vfile'
9+ import { fromParse5 } from '../index.js'
1310
1411var join = path . join
1512
@@ -348,11 +345,13 @@ test('hast-util-from-parse5', function (t) {
348345
349346test ( 'fixtures' , function ( t ) {
350347 var base = join ( 'test' , 'fixtures' )
351- var files = fs . readdirSync ( base ) . filter ( not ( hidden ) )
348+ var files = fs . readdirSync ( base )
352349 var index = - 1
353350
354351 while ( ++ index < files . length ) {
355- each ( files [ index ] )
352+ if ( ! isHidden ( files [ index ] ) ) {
353+ each ( files [ index ] )
354+ }
356355 }
357356
358357 t . end ( )
@@ -366,14 +365,14 @@ test('fixtures', function (t) {
366365
367366 st . plan ( 4 )
368367
369- checkYesYes ( st , fixture , options )
370- checkNoYes ( st , fixture , options )
371- checkYesNo ( st , fixture , options )
372- checkNoNo ( st , fixture , options )
368+ checkYesYes ( st , options )
369+ checkNoYes ( st , options )
370+ checkYesNo ( st , options )
371+ checkNoNo ( st , options )
373372 } )
374373 }
375374
376- function checkYesYes ( t , fixture , options ) {
375+ function checkYesYes ( t , options ) {
377376 var input = parse5 . parse ( String ( options . file ) , {
378377 sourceCodeLocationInfo : true
379378 } )
@@ -382,7 +381,7 @@ test('fixtures', function (t) {
382381
383382 try {
384383 expected = JSON . parse ( fs . readFileSync ( options . out ) )
385- } catch ( _ ) {
384+ } catch {
386385 // New fixture.
387386 fs . writeFileSync ( options . out , JSON . stringify ( actual , 0 , 2 ) + '\n' )
388387 return
@@ -392,7 +391,7 @@ test('fixtures', function (t) {
392391 t . deepEqual ( actual , expected , 'p5 w/ position, hast w/ intent of position' )
393392 }
394393
395- function checkNoYes ( t , fixture , options ) {
394+ function checkNoYes ( t , options ) {
396395 var input = parse5 . parse ( String ( options . file ) )
397396 var actual = fromParse5 ( input , { file : options . file , verbose : true } )
398397 var expected = JSON . parse ( fs . readFileSync ( options . out ) )
@@ -403,7 +402,7 @@ test('fixtures', function (t) {
403402 t . deepEqual ( actual , expected , 'p5 w/o position, hast w/ intent of position' )
404403 }
405404
406- function checkYesNo ( t , fixture , options ) {
405+ function checkYesNo ( t , options ) {
407406 var input = parse5 . parse ( String ( options . file ) , {
408407 sourceCodeLocationInfo : true
409408 } )
@@ -416,7 +415,7 @@ test('fixtures', function (t) {
416415 t . deepEqual ( actual , expected , 'p5 w/ position, hast w/o intent of position' )
417416 }
418417
419- function checkNoNo ( t , fixture , options ) {
418+ function checkNoNo ( t , options ) {
420419 var input = parse5 . parse ( String ( options . file ) )
421420 var actual = fromParse5 ( input )
422421 var expected = JSON . parse ( fs . readFileSync ( options . out ) )
@@ -452,7 +451,7 @@ function cleaner(node) {
452451function log ( label , actual , expected ) {
453452 try {
454453 assert . deepStrictEqual ( actual , expected , label )
455- } catch ( _ ) {
454+ } catch {
456455 console . log ( 'actual:%s:' , label )
457456 console . dir ( actual , { depth : null } )
458457 console . log ( 'expected:%s:' , label )
0 commit comments