Skip to content

Commit

Permalink
fix(middleware): does not work with mootools
Browse files Browse the repository at this point in the history
Change karma.js to use a forEach loop over files.included
Because mootools adds functions to the array prototype,
the use of for..in will get more than the array elements.
  • Loading branch information
Ondoher committed Mar 3, 2017
1 parent cb5c0bb commit ac3dc2e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/middleware/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ var createKarmaMiddleware = function (

var scriptTags = []
var scriptUrls = []
for (var i in files.included) {
var file = files.included[i]
files.included.forEach(function (file) {
var filePath = file.path
var fileExt = path.extname(filePath)

Expand All @@ -191,12 +190,12 @@ var createKarmaMiddleware = function (

if (fileExt === '.css') {
scriptTags.push(util.format(LINK_TAG_CSS, filePath))
continue
return
}

if (fileExt === '.html') {
scriptTags.push(util.format(LINK_TAG_HTML, filePath))
continue
return
}

// The script tag to be placed
Expand All @@ -209,7 +208,7 @@ var createKarmaMiddleware = function (

var crossOriginAttribute = includeCrossOriginAttribute ? CROSSORIGIN_ATTRIBUTE : ''
scriptTags.push(util.format(SCRIPT_TAG, scriptType, filePath, crossOriginAttribute))
}
})

// TODO(vojta): don't compute if it's not in the template
var mappings = files.served.map(function (file) {
Expand Down

0 comments on commit ac3dc2e

Please sign in to comment.