@@ -3,6 +3,10 @@ var expect = require('chai').expect
3
3
var path = require ( 'path' )
4
4
, fs = require ( 'fs' )
5
5
6
+ function isJSFile ( f ) {
7
+ return path . extname ( f ) === '.js'
8
+ }
9
+
6
10
describe ( 'package' , function ( ) {
7
11
let pkg = path . join ( process . cwd ( ) , 'src' )
8
12
, module
@@ -22,7 +26,7 @@ describe('package', function () {
22
26
, function ( err , files ) {
23
27
expect ( err ) . not . to . exist
24
28
25
- files . forEach ( function ( f ) {
29
+ files . filter ( isJSFile ) . forEach ( function ( f ) {
26
30
expect ( module . rules ) . to . have
27
31
. property ( path . basename ( f , '.js' ) )
28
32
} )
@@ -34,9 +38,9 @@ describe('package', function () {
34
38
it ( 'exports all configs' , function ( done ) {
35
39
fs . readdir ( path . join ( process . cwd ( ) , 'config' ) , function ( err , files ) {
36
40
if ( err ) { done ( err ) ; return }
37
- files . forEach ( file => {
41
+ files . filter ( isJSFile ) . forEach ( file => {
38
42
if ( file [ 0 ] === '.' ) return
39
- expect ( module . configs ) . to . have . property ( file . slice ( 0 , - 3 ) ) // drop '.js'
43
+ expect ( module . configs ) . to . have . property ( path . basename ( file , '.js' ) )
40
44
} )
41
45
done ( )
42
46
} )
0 commit comments