From 17c14b119261da16e5b6b23e0bd19add5c08071c Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 2 Jun 2020 09:18:38 +0100 Subject: [PATCH] fix formatting with make format_fix --- app/js/DockerRunner.js | 2 +- app/js/LatexRunner.js | 11 ++++++----- test/unit/js/LatexRunnerTests.js | 14 ++++---------- test/unit/js/ResourceWriterTests.js | 6 +++--- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/app/js/DockerRunner.js b/app/js/DockerRunner.js index e7cb2a7..c50087d 100644 --- a/app/js/DockerRunner.js +++ b/app/js/DockerRunner.js @@ -412,7 +412,7 @@ module.exports = DockerRunner = { }) } ) - var inspectContainer = (isRetry) => + var inspectContainer = isRetry => container.inspect(function(error, stats) { if ((error != null ? error.statusCode : undefined) === 404) { return createAndStartContainer() diff --git a/app/js/LatexRunner.js b/app/js/LatexRunner.js index fe737c7..c3edb29 100644 --- a/app/js/LatexRunner.js +++ b/app/js/LatexRunner.js @@ -132,7 +132,8 @@ module.exports = LatexRunner = { LatexRunner.writeLogOutput(project_id, directory, output, () => { return callback(error, output, stats, timings) }) - })) + } + )) }, writeLogOutput(project_id, directory, output, callback) { @@ -142,9 +143,9 @@ module.exports = LatexRunner = { // internal method for writing non-empty log files function _writeFile(file, content, cb) { if (content && content.length > 0) { - fs.writeFile(file, content, (err) => { + fs.writeFile(file, content, 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() }) @@ -153,8 +154,8 @@ module.exports = LatexRunner = { } } // write stdout and stderr, ignoring errors - _writeFile(Path.join(directory, "output.stdout"), output.stdout, () => { - _writeFile(Path.join(directory, "output.stderr"), output.stderr, () => { + _writeFile(Path.join(directory, 'output.stdout'), output.stdout, () => { + _writeFile(Path.join(directory, 'output.stderr'), output.stderr, () => { callback() }) }) diff --git a/test/unit/js/LatexRunnerTests.js b/test/unit/js/LatexRunnerTests.js index 15902e9..42e816d 100644 --- a/test/unit/js/LatexRunnerTests.js +++ b/test/unit/js/LatexRunnerTests.js @@ -38,7 +38,7 @@ describe('LatexRunner', function() { }) }, './CommandRunner': (this.CommandRunner = {}), - 'fs': (this.fs = { + fs: (this.fs = { writeFile: sinon.stub().callsArg(2) }) } @@ -87,18 +87,12 @@ describe('LatexRunner', function() { .should.equal(true) }) - it('should record the stdout and stderr', function () { + it('should record the stdout and stderr', function() { this.fs.writeFile - .calledWith( - this.directory + '/' + 'output.stdout', - "this is stdout" - ) + .calledWith(this.directory + '/' + 'output.stdout', 'this is stdout') .should.equal(true) this.fs.writeFile - .calledWith( - this.directory + '/' + 'output.stderr', - "this is stderr" - ) + .calledWith(this.directory + '/' + 'output.stderr', 'this is stderr') .should.equal(true) }) }) diff --git a/test/unit/js/ResourceWriterTests.js b/test/unit/js/ResourceWriterTests.js index 1080765..36a9513 100644 --- a/test/unit/js/ResourceWriterTests.js +++ b/test/unit/js/ResourceWriterTests.js @@ -262,19 +262,19 @@ describe('ResourceWriter', function() { .should.equal(true) }) - it('should delete the stdout log file', 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 () { + 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 () { + it('should delete the extra files', function() { return this.ResourceWriter._deleteFileIfNotDirectory .calledWith(path.join(this.basePath, 'extra/file.tex')) .should.equal(true)