Skip to content

Commit

Permalink
fix(file-list): revert "do not preprocess up-to-date files" (#3226) (#…
Browse files Browse the repository at this point in the history
…3230)

This reverts commit 5334d1a
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.
  • Loading branch information
segrey authored and johnjbarton committed Dec 6, 2018
1 parent 169f3a9 commit bb022a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 0 additions & 6 deletions lib/file-list.js
Expand Up @@ -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) => {
Expand Down
8 changes: 1 addition & 7 deletions test/unit/file-list.spec.js
Expand Up @@ -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--
})
})
})

Expand Down

1 comment on commit bb022a7

@carlhopf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! i just ran into the same issue

Please sign in to comment.