diff --git a/CHANGELOG.md b/CHANGELOG.md index e30b9de..8126153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.0 +* always output stack trace for both test failures and errors +* separate failure output sections with true newlines + ## 1.3.1 * updated dependencies: * xml: '^4.3.0' diff --git a/lib/src/impl/report.dart b/lib/src/impl/report.dart index 7e83341..8fae43e 100644 --- a/lib/src/impl/report.dart +++ b/lib/src/impl/report.dart @@ -3,10 +3,10 @@ // license that can be found in the LICENSE file. import 'package:intl/intl.dart'; -import 'package:xml/xml.dart'; -import 'package:testreport/testreport.dart'; import 'package:junitreport/junitreport.dart'; import 'package:junitreport/src/impl/xml.dart'; +import 'package:testreport/testreport.dart'; +import 'package:xml/xml.dart'; class XmlReport implements JUnitReport { static final NumberFormat _milliseconds = NumberFormat('#####0.00#', 'en_US'); @@ -160,7 +160,6 @@ class XmlReport implements JUnitReport { } else { long = message; } - if (message.isNotEmpty && problem.isFailure) stacktrace = ''; var report = []; var type = problem.isFailure ? 'Failure' : 'Error'; @@ -171,7 +170,7 @@ class XmlReport implements JUnitReport { } if (long != null) report.add(long); if (stacktrace.isNotEmpty) report.add('Stacktrace:\n$stacktrace'); - return report.join(r'\n\n'); + return report.join('\n\n'); } String _message(int failures, int errors) { diff --git a/pubspec.yaml b/pubspec.yaml index cf8d73b..959f6b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: junitreport -version: 1.3.2-dev +version: 1.4.0 description: Generate JUnit XML reports from dart test runs. Transforms the output of dart or flutter tests to JUnit style XML diff --git a/tool/example.xml b/tool/example.xml index 965b8d9..e907639 100644 --- a/tool/example.xml +++ b/tool/example.xml @@ -12,7 +12,9 @@ and even two in one go - Failure:\n\nExpected: 'two\n' + Failure: + +Expected: 'two\n' 'lines for seeing how it is rendered' Actual: 'two\n' 'lines that are not expected' @@ -21,10 +23,17 @@ Expected: ... wo\nlines for seeing ... Actual: ... wo\nlines that are n ... ^ Differ at offset 11 + + +Stacktrace: +package:test expect +tool\example-tests\allresults_test.dart 20:5 main.<fn> - Failure:\n\nExpected: 'should fail' + Failure: + +Expected: 'should fail' Actual: 'fails' Which: is different. Expected: should fai ... @@ -32,6 +41,11 @@ Expected: should fai ... ^ Differ at offset 0 the failure reason + + +Stacktrace: +package:test expect +tool\example-tests\allresults_test.dart 25:5 main.<fn> @@ -39,13 +53,20 @@ the failure reason - Failure:\n\nExpected: 'expected1' + Failure: + +Expected: 'expected1' Actual: 'actual1' Which: is different. Expected: expected1 Actual: actual1 ^ Differ at offset 0 + + +Stacktrace: +package:test expect +tool\example-tests\allresults_test.dart 33:5 main.<fn>