diff --git a/services/clsi/app/coffee/ResourceWriter.coffee b/services/clsi/app/coffee/ResourceWriter.coffee index e3639006ee..16000cbbff 100644 --- a/services/clsi/app/coffee/ResourceWriter.coffee +++ b/services/clsi/app/coffee/ResourceWriter.coffee @@ -46,7 +46,7 @@ module.exports = ResourceWriter = do (file) -> path = file.path should_delete = true - if path.match(/^output\./) or path.match(/\.aux$/) + if path.match(/^output\./) or path.match(/\.aux$/) or path.match(/^cache\//) # knitr cache should_delete = false if path == "output.pdf" or path == "output.dvi" or path == "output.log" should_delete = true diff --git a/services/clsi/test/unit/coffee/ResourceWriterTests.coffee b/services/clsi/test/unit/coffee/ResourceWriterTests.coffee index 5480bd6b7c..c1e72a8789 100644 --- a/services/clsi/test/unit/coffee/ResourceWriterTests.coffee +++ b/services/clsi/test/unit/coffee/ResourceWriterTests.coffee @@ -55,6 +55,8 @@ describe "ResourceWriter", -> }, { path: "extra.aux" type: "aux" + }, { + path: "cache/_chunk1" }] @resources = "mock-resources" @OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files) @@ -80,6 +82,11 @@ describe "ResourceWriter", -> @ResourceWriter._deleteFileIfNotDirectory .calledWith(path.join(@basePath, "extra.aux")) .should.equal false + + it "should not delete the knitr cache file", -> + @ResourceWriter._deleteFileIfNotDirectory + .calledWith(path.join(@basePath, "cache/_chunk1")) + .should.equal false it "should call the callback", -> @callback.called.should.equal true