diff --git a/lib/file-list.js b/lib/file-list.js index 64e25b4c8..b512caf8b 100644 --- a/lib/file-list.js +++ b/lib/file-list.js @@ -228,7 +228,7 @@ Object.defineProperty(List.prototype, 'files', { }) var uniqFlat = function (list) { - return _.uniq(_.flatten(list), true, 'path') + return _.uniq(_.flatten(list), 'path') } return { diff --git a/test/unit/file-list.spec.coffee b/test/unit/file-list.spec.coffee index 62073650f..24322cf12 100644 --- a/test/unit/file-list.spec.coffee +++ b/test/unit/file-list.spec.coffee @@ -268,6 +268,24 @@ describe 'FileList', -> expect(file1.mtime).to.be.eql mg.statCache['/some/a.js'].mtime expect(file2.mtime).to.be.eql mg.statCache['/some/b.js'].mtime + it 'should sort files within buckets and keep order of patterns (buckets)', -> + # /a.* => /a.txt [MATCH in *.txt as well] + # /some/*.js => /some/a.js, /some/b.js [/some/b.js EXCLUDED] + # *.txt => /c.txt, a.txt, b.txt [UNSORTED] + list = new List( + patterns('/a.*', '/some/*.js', '*.txt'), + ['**/b.js'], + emitter, + preprocess + ) + + list.refresh().then (files) -> + expect(pathsFrom files.served).to.deep.equal [ + '/a.txt', + '/some/a.js', + '/b.txt', + '/c.txt' + ] it 'ingores excluded files', -> list = new List(