diff --git a/lib/tools/weightChecker/weightChecker.js b/lib/tools/weightChecker/weightChecker.js index dfc00b3..b09d029 100644 --- a/lib/tools/weightChecker/weightChecker.js +++ b/lib/tools/weightChecker/weightChecker.js @@ -155,6 +155,7 @@ var WeightChecker = function() { requests.forEach(function(req) { var weight = ((typeof req.weightCheck.bodySize === 'number') ? req.weightCheck.bodySize + req.weightCheck.headersSize : req.contentLength) || 0; var type = req.type || 'other'; + type = (results.byType[type]) ? type : 'other'; results.totalWeight += weight; results.byType[type].totalWeight += weight; @@ -275,6 +276,8 @@ var WeightChecker = function() { requests.forEach(function(req) { if (req.url !== 'about:blank') { var type = req.type || 'other'; + type = (results.byType[type]) ? type : 'other'; + results.byType[type].push(req.url); results.total ++; } diff --git a/test/core/weightCheckerTest.js b/test/core/weightCheckerTest.js index f7e3283..2e93bea 100644 --- a/test/core/weightCheckerTest.js +++ b/test/core/weightCheckerTest.js @@ -142,7 +142,7 @@ describe('weightChecker', function() { data.toolsResults.weightChecker.offenders.should.have.a.property('gzipCompression'); data.toolsResults.weightChecker.offenders.gzipCompression.totalGain.should.be.above(0); - data.toolsResults.weightChecker.offenders.gzipCompression.files.length.should.equal(4); + data.toolsResults.weightChecker.offenders.gzipCompression.files.length.should.equal(5); data.toolsResults.weightChecker.offenders.should.have.a.property('fileMinification'); data.toolsResults.weightChecker.offenders.fileMinification.totalGain.should.be.above(0);