From bb07373d0eb611cc918ff90d16d422f2e1fa4b4c Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Thu, 6 Dec 2018 19:18:04 +0300 Subject: [PATCH] fix(file-list): revert "do not preprocess up-to-date files" (#3226) This reverts commit 5334d1a8 karma-webpack preprocessor updates bundle when needed, but karma's fileList consists of a single entry file which is usually unmodified. In this case, fileList.refresh() should always call preprocessor for the single entry file, avoiding preprocessing of unmodified files is done on karma-webpack side. --- lib/file-list.js | 6 ------ test/unit/file-list.spec.js | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/file-list.js b/lib/file-list.js index f175a86e3..a6dac0f25 100644 --- a/lib/file-list.js +++ b/lib/file-list.js @@ -102,12 +102,6 @@ class FileList { return Promise.resolve(file) } - const prevFile = this._findFile(path, patternObject) - if (prevFile && file.mtime <= prevFile.mtime) { - log.debug(`Not preprocessing "${path}" as file hasn't been changed since the last preprocessing`) - return Promise.resolve(prevFile) - } - return this._preprocess(file).then(() => file) }) .then((files) => { diff --git a/test/unit/file-list.spec.js b/test/unit/file-list.spec.js index bd2c9241a..3bec4bc68 100644 --- a/test/unit/file-list.spec.js +++ b/test/unit/file-list.spec.js @@ -375,15 +375,9 @@ describe('FileList', () => { }) }) - it('preprocesses new and/or changed files', () => { + it('preprocesses all files', () => { return list.refresh().then((files) => { expect(preprocess.callCount).to.be.eql(5) - preprocess.resetHistory() - mg.statCache['/some/a.js'].mtime++ - return list.refresh().then((files) => { - expect(preprocess.callCount).to.be.eql(1) - mg.statCache['/some/a.js'].mtime-- - }) }) })