marick / Midje

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing
MIT License
1.69k stars 129 forks source link

Junit emitter is missing newlines in its output #457

Closed lverns closed 5 years ago

lverns commented 5 years ago

Summary

The Junit XML files are missing newlines between the failure header and the "Expected" label, as well as between the expected value and the "Actual" label

Example

Given a simple test namespace:

(ns midje-demo.core-test
  (:require [midje.sweet :refer :all]))

(fact "fixme, I fail."
      1 => 2)

With ./midje.clj

(change-defaults :emitter 'midje.emission.plugins.junit
                 :pretty-print false
                 :colorize false)

Then running (midje.repl/load-facts) in the REPL causes the following file to be generated

<testsuite name='midje-demo.core-test'>
<testcase classname='midje-demo.core-test' name='fixme, I fail.'>

<failure type=':actual-result-did-not-match-expected-value'>
<![CDATA[
FAIL fixme, I fail. at (core_test.clj:5)Expected:
2Actual:
1]]>
</failure>

</testcase>
</testsuite>

I would instead expect the CDATA chunk to be:

<![CDATA[
FAIL fixme, I fail. at (core_test.clj:5)
Expected:
2
Actual:
1]]>