Skip to content

Commit

Permalink
Merge pull request #19 from dannyfallon/df/fix-keep-gzip-return-context
Browse files Browse the repository at this point in the history
Fix the plugin return object for keep-enabled gzipping
  • Loading branch information
Aaron Chambers committed Feb 26, 2016
2 parents e7969c4 + 6a8f099 commit 4cbb865
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ module.exports = {
if (keep) {
self.log('keep is enabled, added gzipped files to `context.distFiles`', { verbose: true });
return {
distFiles: gzippedFiles,
distFiles: [].concat(gzippedFiles), // needs to be a copy
gzippedFiles: gzippedFiles
}
};
}
return { gzippedFiles: gzippedFiles };
})
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/index-nodetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ describe('gzip plugin', function() {
done(reason);
});
});

it('does not use the same object for gzippedFiles and distFiles', function(done) {
return assert.isFulfilled(plugin.willUpload(context))
.then(function(result) {
assert.notStrictEqual(result.distFiles, result.gzippedFiles);
done();
}).catch(function(reason){
done(reason);
});
});
});
});
});

0 comments on commit 4cbb865

Please sign in to comment.