1- /*
2- eslint global-require: 0,
3- import/no-dynamic-require: 0,
4- no-restricted-syntax: 0
5- */
6- import { expect } from 'chai' ;
71import path from 'path' ;
2+ import { expect as chaiExpect } from 'chai' ;
83import { readFileSync } from 'fs' ;
94import collect from '../src/collect' ;
105
@@ -22,7 +17,7 @@ const testFilenames = [
2217
2318const testResults = testFilenames . map ( ( filename , index ) => {
2419 const root = process . cwd ( ) ;
25- const filepath = path . join ( root , `./ test/ ${ filename } ` ) ;
20+ const filepath = path . join ( root , ' test' , filename ) ;
2621 const stdin = readFileSync ( filepath ) . toString ( ) ;
2722 const parsedJSONArray = collect ( stdin , root , filepath ) ;
2823
@@ -34,7 +29,7 @@ describe('Format', () => {
3429 it ( `${ filename } - should have expected properties` , done => {
3530 const exactFormat = require ( `./${ filename } ` . replace ( 'example' , 'expect' ) ) ;
3631
37- expect ( parsedJSONArray ) . to . be . an ( 'array' ) ;
32+ chaiExpect ( parsedJSONArray ) . to . be . an ( 'array' ) ;
3833
3934 // Filter out the 'path' property because this changes between environments
4035 expect ( parsedJSONArray . map ( e => ( {
@@ -43,13 +38,14 @@ describe('Format', () => {
4338 loc : { start : e . loc . start , end : e . loc . end } ,
4439 message : e . message ,
4540 start : e . start
46- } ) ) ) . to . eql ( exactFormat ) ;
41+ } ) ) )
42+ . toEqual ( exactFormat ) ;
4743
4844 for ( const e of parsedJSONArray ) {
4945 if ( e !== false ) {
50- expect ( e . type ) . to . be . a ( 'string' ) ;
51- expect ( e . path ) . to . be . a ( 'string' ) . that . includes ( path . join ( process . cwd ( ) , 'test' ) ) ;
52- expect ( e . path ) . to . be . a ( 'string' ) . that . includes ( '.example.js' ) ;
46+ chaiExpect ( e . type ) . to . be . a ( 'string' ) ;
47+ chaiExpect ( e . path ) . to . be . a ( 'string' ) . that . contains ( path . join ( process . cwd ( ) , 'test' ) ) ;
48+ chaiExpect ( e . path ) . to . be . a ( 'string' ) . that . contains ( '.example.js' ) ;
5349 }
5450 }
5551
0 commit comments