From 5d94569dd32296e27fe13ff930157d0ab5609f3b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 21 Dec 2016 14:52:11 -0800 Subject: [PATCH] [Tests] make package tests more robust by only checking .js files --- tests/src/package.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/src/package.js b/tests/src/package.js index 8abf09aa0..9f66c6607 100644 --- a/tests/src/package.js +++ b/tests/src/package.js @@ -3,6 +3,10 @@ var expect = require('chai').expect var path = require('path') , fs = require('fs') +function isJSFile(f) { + return path.extname(f) === '.js' +} + describe('package', function () { let pkg = path.join(process.cwd(), 'src') , module @@ -22,7 +26,7 @@ describe('package', function () { , function (err, files) { expect(err).not.to.exist - files.forEach(function (f) { + files.filter(isJSFile).forEach(function (f) { expect(module.rules).to.have .property(path.basename(f, '.js')) }) @@ -34,9 +38,9 @@ describe('package', function () { it('exports all configs', function (done) { fs.readdir(path.join(process.cwd(), 'config'), function (err, files) { if (err) { done(err); return } - files.forEach(file => { + files.filter(isJSFile).forEach(file => { if (file[0] === '.') return - expect(module.configs).to.have.property(file.slice(0, -3)) // drop '.js' + expect(module.configs).to.have.property(path.basename(file, '.js')) }) done() })