fix formatting with make format_fix

This commit is contained in:
Brian Gough 2020-06-02 09:18:38 +01:00
parent d9265b779f
commit a3d27b63f1
4 changed files with 14 additions and 19 deletions

View file

@ -412,7 +412,7 @@ module.exports = DockerRunner = {
}) })
} }
) )
var inspectContainer = (isRetry) => var inspectContainer = isRetry =>
container.inspect(function(error, stats) { container.inspect(function(error, stats) {
if ((error != null ? error.statusCode : undefined) === 404) { if ((error != null ? error.statusCode : undefined) === 404) {
return createAndStartContainer() return createAndStartContainer()

View file

@ -132,7 +132,8 @@ module.exports = LatexRunner = {
LatexRunner.writeLogOutput(project_id, directory, output, () => { LatexRunner.writeLogOutput(project_id, directory, output, () => {
return callback(error, output, stats, timings) return callback(error, output, stats, timings)
}) })
})) }
))
}, },
writeLogOutput(project_id, directory, output, callback) { writeLogOutput(project_id, directory, output, callback) {
@ -142,9 +143,9 @@ module.exports = LatexRunner = {
// internal method for writing non-empty log files // internal method for writing non-empty log files
function _writeFile(file, content, cb) { function _writeFile(file, content, cb) {
if (content && content.length > 0) { if (content && content.length > 0) {
fs.writeFile(file, content, (err) => { fs.writeFile(file, content, err => {
if (err) { if (err) {
logger.error({ project_id, file }, "error writing log file") // don't fail on error logger.error({ project_id, file }, 'error writing log file') // don't fail on error
} }
cb() cb()
}) })
@ -153,8 +154,8 @@ module.exports = LatexRunner = {
} }
} }
// write stdout and stderr, ignoring errors // write stdout and stderr, ignoring errors
_writeFile(Path.join(directory, "output.stdout"), output.stdout, () => { _writeFile(Path.join(directory, 'output.stdout'), output.stdout, () => {
_writeFile(Path.join(directory, "output.stderr"), output.stderr, () => { _writeFile(Path.join(directory, 'output.stderr'), output.stderr, () => {
callback() callback()
}) })
}) })

View file

@ -38,7 +38,7 @@ describe('LatexRunner', function() {
}) })
}, },
'./CommandRunner': (this.CommandRunner = {}), './CommandRunner': (this.CommandRunner = {}),
'fs': (this.fs = { fs: (this.fs = {
writeFile: sinon.stub().callsArg(2) writeFile: sinon.stub().callsArg(2)
}) })
} }
@ -87,18 +87,12 @@ describe('LatexRunner', function() {
.should.equal(true) .should.equal(true)
}) })
it('should record the stdout and stderr', function () { it('should record the stdout and stderr', function() {
this.fs.writeFile this.fs.writeFile
.calledWith( .calledWith(this.directory + '/' + 'output.stdout', 'this is stdout')
this.directory + '/' + 'output.stdout',
"this is stdout"
)
.should.equal(true) .should.equal(true)
this.fs.writeFile this.fs.writeFile
.calledWith( .calledWith(this.directory + '/' + 'output.stderr', 'this is stderr')
this.directory + '/' + 'output.stderr',
"this is stderr"
)
.should.equal(true) .should.equal(true)
}) })
}) })

View file

@ -262,19 +262,19 @@ describe('ResourceWriter', function() {
.should.equal(true) .should.equal(true)
}) })
it('should delete the stdout log file', function () { it('should delete the stdout log file', function() {
return this.ResourceWriter._deleteFileIfNotDirectory return this.ResourceWriter._deleteFileIfNotDirectory
.calledWith(path.join(this.basePath, 'output.stdout')) .calledWith(path.join(this.basePath, 'output.stdout'))
.should.equal(true) .should.equal(true)
}) })
it('should delete the stderr log file', function () { it('should delete the stderr log file', function() {
return this.ResourceWriter._deleteFileIfNotDirectory return this.ResourceWriter._deleteFileIfNotDirectory
.calledWith(path.join(this.basePath, 'output.stderr')) .calledWith(path.join(this.basePath, 'output.stderr'))
.should.equal(true) .should.equal(true)
}) })
it('should delete the extra files', function () { 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)