clean up log file deletion and add unit test
This commit is contained in:
@@ -201,10 +201,6 @@ module.exports = ResourceWriter = {
|
|||||||
// knitr cache
|
// knitr cache
|
||||||
should_delete = false
|
should_delete = false
|
||||||
}
|
}
|
||||||
if (path.match(/^output.(stdout|stderr)$/)) {
|
|
||||||
// latexmk output
|
|
||||||
should_delete = true
|
|
||||||
}
|
|
||||||
if (path.match(/^output-.*/)) {
|
if (path.match(/^output-.*/)) {
|
||||||
// Tikz cached figures (default case)
|
// Tikz cached figures (default case)
|
||||||
should_delete = false
|
should_delete = false
|
||||||
@@ -235,7 +231,9 @@ module.exports = ResourceWriter = {
|
|||||||
path === 'output.pdf' ||
|
path === 'output.pdf' ||
|
||||||
path === 'output.dvi' ||
|
path === 'output.dvi' ||
|
||||||
path === 'output.log' ||
|
path === 'output.log' ||
|
||||||
path === 'output.xdv'
|
path === 'output.xdv' ||
|
||||||
|
path === 'output.stdout' ||
|
||||||
|
path === 'output.stderr'
|
||||||
) {
|
) {
|
||||||
should_delete = true
|
should_delete = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,6 +230,12 @@ describe('ResourceWriter', function() {
|
|||||||
{
|
{
|
||||||
path: '_markdown_main/30893013dec5d869a415610079774c2f.md.tex',
|
path: '_markdown_main/30893013dec5d869a415610079774c2f.md.tex',
|
||||||
type: 'tex'
|
type: 'tex'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'output.stdout'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'output.stderr'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
this.resources = 'mock-resources'
|
this.resources = 'mock-resources'
|
||||||
@@ -256,7 +262,19 @@ describe('ResourceWriter', function() {
|
|||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should delete the extra files', function() {
|
it('should delete the stdout log file', function () {
|
||||||
|
return this.ResourceWriter._deleteFileIfNotDirectory
|
||||||
|
.calledWith(path.join(this.basePath, 'output.stdout'))
|
||||||
|
.should.equal(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should delete the stderr log file', function () {
|
||||||
|
return this.ResourceWriter._deleteFileIfNotDirectory
|
||||||
|
.calledWith(path.join(this.basePath, 'output.stderr'))
|
||||||
|
.should.equal(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should delete the extra files', function () {
|
||||||
return this.ResourceWriter._deleteFileIfNotDirectory
|
return this.ResourceWriter._deleteFileIfNotDirectory
|
||||||
.calledWith(path.join(this.basePath, 'extra/file.tex'))
|
.calledWith(path.join(this.basePath, 'extra/file.tex'))
|
||||||
.should.equal(true)
|
.should.equal(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user