Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] make package tests more robust by only checking .js files #697

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/src/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'))
})
Expand All @@ -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()
})
Expand Down