From 7a7c2ee9920e612cdf1485cb3efaaf62d5447c22 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 8 Mar 2017 11:48:36 +0000 Subject: [PATCH] improve debugging of failed acceptance tests use the example name in the output filename --- test/acceptance/coffee/ExampleDocumentTests.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/acceptance/coffee/ExampleDocumentTests.coffee b/test/acceptance/coffee/ExampleDocumentTests.coffee index 6c9e96b..43dbff3 100644 --- a/test/acceptance/coffee/ExampleDocumentTests.coffee +++ b/test/acceptance/coffee/ExampleDocumentTests.coffee @@ -16,11 +16,13 @@ convertToPng = (pdfPath, pngPath, callback = (error) ->) -> callback() compare = (originalPath, generatedPath, callback = (error, same) ->) -> - proc = ChildProcess.exec "compare -metric mae #{fixturePath(originalPath)} #{fixturePath(generatedPath)} #{fixturePath("tmp/diff.png")}" + diff_file = "#{fixturePath(generatedPath)}-diff.png" + proc = ChildProcess.exec "compare -metric mae #{fixturePath(originalPath)} #{fixturePath(generatedPath)} #{diff_file}" stderr = "" proc.stderr.on "data", (chunk) -> stderr += chunk proc.on "exit", () -> if stderr.trim() == "0 (0)" + fs.unlink diff_file # remove output diff if test matches expected image callback null, true else console.log "compare result", stderr @@ -68,7 +70,7 @@ describe "Example Documents", -> do (example_dir) -> describe example_dir, -> before -> - @project_id = Client.randomId() + @project_id = Client.randomId() + "_" + example_dir it "should generate the correct pdf", (done) -> Client.compileDirectory @project_id, fixturePath("examples"), example_dir, 4242, (error, res, body) =>